Open XilinMao opened 3 years ago
I cannot find the mentioned inconsistency since setting the NA
in another column also produces an analogous result under current dev version 1.14.3
.
test <- matrix(letters[1:12], 3, 4)
test[2, 4] <- NA
test <- data.table(test)
test
#> V1 V2 V3 V4
#> 1: a d g j
#> 2: b e h <NA>
#> 3: c f i l
tmp <- tempfile()
fwrite(test, tmp)
test2 <- fread(tmp)
test2
#> V1 V2 V3 V4
#> 1: a d g j
#> 2: b e h
#> 3: c f i l
test <- matrix(letters[1:12], 3, 4)
test[2, 3] <- NA
test <- data.table(test)
test
#> V1 V2 V3 V4
#> 1: a d g j
#> 2: b e <NA> k
#> 3: c f i l
tmp <- tempfile()
fwrite(test, tmp)
test2 <- fread(tmp)
test2
#> V1 V2 V3 V4
#> 1: a d g j
#> 2: b e k
#> 3: c f i l
#
Minimal reproducible example
I write character data.table to a csv file. The last column contain
NA
The csv file like this:
When I read it, it becomes empty string, not
NA
I find this would not happen when
NA
is not in the last column, and when data isnumeric
typeI know I can solve it by setting
na.strings=""
, but I want to know if this inconsistency (NA
in last column or not) is a bug? And howfread
process this situation?#
Output of sessionInfo()