Possible duplicate:
Select NA in the data table in R
just wondering if this is an assigned function or error in data.table?
a = data.frame(a=c(NA,1),aa=c(0,11)) b = data.frame(a=c(1),bb=c(11)) merge(a,b,all.x=T,by="a") a aa bb 1 1 11 11 2 NA 0 NA a = data.table(a=c(NA,1),aa=c(0,11)) b = data.table(a=c(1),bb=c(11)) merge(a,b,all.x=T,by="a") a aa bb 1: NA 0 11 2: 1 11 11
again this way
setkey(b,a) b[a] a bb aa 1: NA 11 0 2: 1 11 11
I would really expect the behavior you would get with data.frame in this case.
thansk
source share