I was loading my csv file with plain:
baseData <- read.csv(datafile)
baseData <- fread(input = paste("zcat < ", datafile, sep=""))
d <- baseData[baseData$some_prop==0,]
d <- d[!is.na(d[,"col"]) & (d[,"col"] == 0 | d[,"col"] == 1),]
incorrect number of dimensions
In a data.table the
j part of the subsetting is meant to return a new value and the columns names should not be quoted or you'll get back exactly this value.
>d<-data.table(A=1:5,B=5:10) > d[,A]  1 2 3 4 5 1 > d[,B]  5 6 7 8 9 10 > d[,"B"]  "B"
So for you particular case, removing the quotes around the columns names should fix the error.
If your code is quite long and use
data.frame methods, you can use
setDF(d) to make it work as-is before refactoring it.
To be complete, the error arise because your logical statement is of length 1 (
"col" == whatever does just return one value
FALSE), not matching the number of rows of your data.table object.