- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1k
Closed
Description
With @dselivanov's excellent PR, providing na.strings value doesn't result in columns being coerced to character anymore.
There's still one point left to address though, as mentioned under that PR -- cases like these:
require(data.table)
DT = data.table(a=9:10, b=9:10 + 0.1, c=as.logical(0:1))
text = do.call("paste", c(DT, collapse="\n", sep=","))
ans1 = fread(text, na.strings=c("9", "9.1", "FALSE"))
#    V1   V2    V3
#1:  9  9.1 FALSE
#2: 10 10.1  TRUE
sapply(ans1, class)
#         V1        V2        V3 
#  "integer" "numeric" "logical" 
# whereas read.table() gives
ans2 = read.table(text=text, na.strings=c("9", "9.1", "FALSE"), sep=",", header=FALSE)
#   V1   V2   V3
#1 NA   NA   NA
#2 10 10.1 TRUE
sapply(ans2, class)
#         V1        V2        V3 
#  "integer" "numeric" "logical" read.table() handles them correctly.