Repository navigation
fread/fwrite default options for NA mismatch #2281
Copy link
Copy link
Open
Description
Activity
Appears to be the same issue as #2214
Thanks I saw the issue you re refering to but I thought it was a similar but different problem.
- Care to elaborate?…On Thu, Aug 3, 2017 at 12:58 PM, benoit ***@***.***> wrote: Thanks I saw the issue you re refering to but I thought it was a similar but different problem. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#2281 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AHQQdQ_M3FMV9dhd2emJte6qCvyxjgMZks5sUiZWgaJpZM4Oscyu> .
Just it looked like the other issue is more involved and requires more changes than this one but all fine ;)
Thanks @BenoitLondon. Agree.
I've just checked that this is now fixed with the PR #2652 that's in discussion currently. I'll link there back to here and this issue will be closed if and when that PR is merged.> dt <- data.table(a = c(NA_integer_, 1L, 2L), b = c("a", "b", NA_character_)) > tmp <- tempfile() > fwrite(dt, tmp) > dt2 <- fread(tmp) > dt a b 1: NA a 2: 1 b 3: 2 <NA> > dt2 a b 1: NA a 2: 1 b 3: 2 <NA> > identical(dt,dt2) [1] TRUE
I think this is still not fixed ? Or back with an issue ?
Should default in fwrite for NA not be ... NA ?
> dt <- data.table(a = c(NA_integer_, 1L, 2L), b = c("a", "b", NA_character_)) > tmp <- tempfile() > fwrite(dt, tmp) > dt2 <- fread(tmp) > dt a b 1: NA a 2: 1 b 3: 2 <NA> > dt2 a b 1: NA a 2: 1 b 3: 2Reacted by benoit and Connor P. Jackson1 remaining item
Cannot reproduce on
Ubuntu 20.04withdata.table 1.4.1
Hi,
first thank you for this package. :)
I had a problem when saving and reading a csv with fread and fwrite
So I realised fread and fwrite have different default for na(-strings), so I checked read.csv and write.csv and they use the same default option.
In the end it mixes empty strings with NA which is not an expected default behavior imho.
Shouldn't fwrite use the same default option as write.csv i.e. na = "NA" or NA? so that a call to fread after fwrite would recover the same object?
Cheers,
Benoit