The example in the question is too simple to show the problem, therefore, confusion and discussion. Using two data.table columns data.table not enough to show what merge does!
Here is a better example:
> a = data.table(P=1:2,Q=3:4,key='P') > b = data.table(P=2:3,R=5:6,key='P') > a PQ 1: 1 3 2: 2 4 > b PR 1: 2 5 2: 3 6 > merge(a,b)
Ricardo reached the end and fixed it in version 1.8.9. From the news:
merge no longer returns false NA strings when y is empty and all.y = TRUE (or all = TRUE), # 2633 . thanks to Vinicius Almendre for the message. Added test.
source share