-
Notifications
You must be signed in to change notification settings - Fork 978
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
fwrite/fread single column input with NA -vs- empty lines #2106
Comments
There are no separators in any line, and the last line is blank. Absent separators,
One potential fix: add a dummy column:
Now |
@MichaelChirico Side note: to cat it to the console, just use
So it can be reproduced like...
Yeah, I'm inclined towards saying the file should be written better if it wants blank lines read as NA (rather than reconfigure fread to treat this one-column case specially). I mean:
|
@franknarf1 nice, the default to write to And I like your fix better, but not sure if it's the user's responsibility to handle a case like that, or if |
The warning message is there. And there are arguments to control it.
Perhaps "Consider fill=TRUE and blank.lines.skip=TRUE" should be added to the warning message? (TODO1) |
Also the empty lines can be controlled in
|
I just read again and understood @MichaelChirico's comment now :
Yes - nice idea! Happy to make that change. (TODO2) |
Closed by #2451 |
Great.
|
Now that |
I create a toy example.
temp <- data.table(a=c(1,NA,2,3,999,NA))
I save it:
fwrite(temp, "temp.csv", quote=FALSE, sep=",", append=F)
and read it again:
my <- fread("temp.csv", stringsAsFactors=F)
As you can see only the first line is read.
I don't know if it's a problem with fread or with fwrite's output file.
The text was updated successfully, but these errors were encountered: