You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run fread specifying na.strings is this not respected by stringsAsFactors? I see in the code that as.factor is called without the exclude= argument.
I'm asking because I get factors with NA as one of the levels. This means DT[is.na(factorcol),] returns no rows which is not what I was expecting. The workaround it to use DT[is.na(levels(factorcol)),]
I don't fully understand this. There's no reproducible example or version number. But I think its duplicate of #1408 and news item 14 under bug fixes for v1.9.7. We don't use as.factor() but our own as_factor().
Please try with devel version before posting.
# v1.9.7 (latest commit)
require(data.table)
fread('a,b\na,2\nb,3\nc,4\nNA,5\n', stringsAsFactors=TRUE, na.strings=c("NA", "c"))[is.na(a)]
# a b# 1: NA 4# 2: NA 5
If I seem to have misunderstood, please explain with a reproducible example. Thanks.
Activity
arunsrinivasan commentedon Dec 11, 2015
I don't fully understand this. There's no reproducible example or version number. But I think its duplicate of #1408 and news item 14 under bug fixes for v1.9.7. We don't use
as.factor()but our ownas_factor().Please try with devel version before posting.
If I seem to have misunderstood, please explain with a reproducible example. Thanks.
JamesOwers commentedon Dec 11, 2015
Exactly what I needed. Many thanks. Your mind reading skills are on point. Apologies for poor description 😞