Data.table - join NA keys

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

+2
source share
1 answer

See FR # 1043 Allow or Deny NA in Keys. .

This is a known issue, NA values ​​are valid, but you cannot join them.

See the duplicate question and answer. Choose NA in the data table in R for a more detailed description.

+4
source

All Articles