Assume we have the following simple case taken from the data.table documentation: (via ?data.table)
DT = data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
X = data.table(x=c("c","b"), v=8:7, foo=c(4,2))
I dont understand the labels given in the example of the documentation:
DT[X, on="x"] # right join (1)
X[DT, on="x"] # left join (2)
How can I say the first case (1) is a right join? I mean from my understanding I need to know which table is "right" and which is "left" to begin with before I can create a left outer or a right outer join.
When I execute the commands, (1) results in a join of X on DT, and (2) results in a join of DT on x.
So the correct labeling from my understanding would be: (1) outer merge of X on DT and (2) outer merge of DT on X, but I cannot make any statement on the direction. It seems incorrect that (1) is the reverse of (2), because that is not true. What am I missing?