Column of explicitly quoted empty strings parsed as logical NA vector

Open
#5,325 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reproducing the issue with the supplied test.csv contents and data.table::fread("test.tsv"), then trace the input parsing path that determines the column type. Done means a column containing only explicitly quoted empty strings is parsed as a character vector of empty strings rather than a logical vector of NA values, with regression coverage for this case.

Written by the indexing model from the issue text.

Description

fread

Let test.csv be the file with contents

col
""
""
""

This is unambiguously a column of empty strings, yet data.table::fread("test.tsv") parses this as a logical class vector with NA values (and, maybe not unexpectedly, no setting of na.strings changes this since the column isn't getting parsed as strings in the first place). As long as one non-empty string is added into the column, e.g.

col
hotdog
""
""
""

then data.table::fread("test.tsv") correctly identifies this as a string column and parses it into a character vector with one non-empty, 3 empty, and 0 NA values.

Package data.table version 1.14.2, running on RedHat linux, with R version 3.6.0.

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.