25
How do I select all the rows that have a missing value in the primary key in a data table.
DT = data.table(x=rep(c("a","b",NA),each=3), y=c(1,3,6), v=1:9)
setkey(DT,x)
Selecting for a particular value is easy
DT["a",]
Selecting for the missing values seems to require a vector search. One cannot use binary search. Am I correct?
DT[NA,]# does not work
DT[is.na(x),] #does work