You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm merging two data.tables with a key of type factor containing an NA entry. For keys appearing only in the first table, the columns from the second table don't contain NA, as expected from ?merge, but instead get copied from the NA row. See row 3, column v.y in the following example:
x<-data.table(k=as.factor(c(NA,1,2)),v=c(0,1,2))
y<-data.table(k=as.factor(c(NA,1,3)),v=c(0,1,3))
merge(x,y,all=T,by="k")
# k v.x v.y#1: NA 0 0#2: 1 1 1#3: 2 2 0#4: 3 NA 3
This is very similar to the issue reported in this SO post, but it should be fixed as of v1.8.11 according to the comment there.
Activity
arunsrinivasan commentedon Nov 11, 2014
@stewbasic thanks for the nice minimal example.