Is this a bug in data.table::fread
(version 1.9.2) or misplaced user expectation/error?
Consider this trivial example where I have a table of values, TAB
separated with possibly missing values. If the values are missing in the first column, fread
gets upset, but if missing values are elsewhere I return the data.table
I expect:
# Data with missing value in first column, third row and last column, second row:
12 876 19
23 39
15 20
fread("12 876 19
23 39
15 20")
#Error in fread("1287619
2339
1520") :
# Not positioned correctly after testing format of header row. ch=' '
# Data with missing values last column, rows two and three:
"12 876 19
23 39
15 20 "
fread( "12 876 19
23 39
15 20 " )
# V1 V2 V3
#1: 12 876 19
#2: 23 39 NA
#3: 15 20 NA
# Returns as expected.
Is this a bug or is it not possible to have missing values in the first column (or do I have malformed data somehow?).
See Question&Answers more detail:os