-
Notifications
You must be signed in to change notification settings - Fork 982
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
fread reads in empty fields as logical NA #1159
Comments
Why should it be read as character by default? Why not specify |
Because an empty column does not fit in a logical type without loss of information. After reading it in, you can't know anymore if you had an all NA column in your csv or all empty.
|
I see. Then presence of any empty element should result in a character column? fread("a,b\n1,\n2,NA")
fread("a,b\n1,\n2,5") In the last case, I guess you'd agree it makes sense to have it as integer column, even though (strictly speaking) that is also loss of information...? |
I didn't consider that, but I think you're right and presence of any empty element should result in a character column by default (at least as long as It feels like |
Thanks, I get it now. |
I'm hoping PR #2652 resolves this one. |
The following results in very unpleasant behavior if you read and subsequently write a csv:
Second column is read in as a logical column, which means empty values get converted to NA. Those columns should instead be read in as character.
The text was updated successfully, but these errors were encountered: