Possible Duplicate:
Select NA in a data.table in R
just wondering if this is an intended feature or a bug 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
same again this way
setkey(b,a)
b[a]
a bb aa
1: NA 11 0
2: 1 11 11
I'd really expect the behaviour you get with data.frame this case.
thansk