-
Notifications
You must be signed in to change notification settings - Fork 979
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 converting empty string to NA if all rows have empty string for that column #4579
Comments
Column was recognized as logical, if we force it to character then you get what you need. fread(input = 'A,B\n1,""\n2,""', colClasses=c("integer","character"))
# A B
# <int> <char>
#1: 1
#2: 2 Feel free to close this issue, turn it into FR, or a documentation update request. |
thx for the quick response! using I'm not sure if this is a functionality or a documentation issue. It does seem to me that the docs are correct here and that I would have to leave this as your call as to whether its a functionality issue or a doc issue, but suspect it has to be one or the other |
one last thought. if |
That sounds like a FR :) |
ok, now my head hurts ;)
wow, I did not expect that! here I was thinking Are there known use cases where treating something surrounded by |
no idea, when I do use fread, I usually do it on a good quality csv files, so I won't have good insight in such problems. |
having thought about this a bit, the most compelling argument went in the direction of round-tripping fread and fwrite of empty string. This lead me to #2524, where some of these ideas have been explored. I have concluded that roundtripping via CSV is probably not the way to think about things. if one wants to persist state with data-type integrity, a database or binary format is probably the way to go. that largely leaves this as an edge case that can currently be handled by an explicit colClasses and am happy to accept whatever get concluded in #2524 |
I think CSVY is what is meant to address the fact that csv doesn't have schema |
docs say:
,"",
is unambiguous and read as an empty string, so the second example below seems like an error. I'm not sure how to work around this at the momentThe text was updated successfully, but these errors were encountered: