Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column of explicitly quoted empty strings parsed as logical NA vector #5325

Open
jwimberl opened this issue Feb 4, 2022 · 2 comments
Open
Labels

Comments

@jwimberl
Copy link

jwimberl commented Feb 4, 2022

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.

@ben-schwen
Copy link
Member

I don't consider your example with fread(text='col\n""\n""\n') as unambiguous.

What is in your opinion the intended output of fread(text='col\n"1"\n""\n')?

@zoushucai
Copy link

I also encountered this issue. Setting na. strings doesn't seem to work, I need to treat "" as NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants