[datatable-help] join example from faq

Juliet Hannah juliet.hannah at gmail.com
Wed Jun 6 19:47:00 CEST 2012


All,

I am not understanding a few basic things. I am looking at pg 5 of the faq.

X = data.table(grp=c("a","a","b","b","b","c","c"), foo=1:7)
setkey(X,grp)
 Y = data.table(c("b","c"), bar=c(4,2))
 X[Y]

The faq says X[Y] is a join looking up X's rows using Y.

Does this mean data.table looks up X's key using Y?

Y has two columns. How does it know to use the first column in this
example? Y's key has not been set.

Hope my question is not too obvious. :)

Thanks,

Juliet

P.S. Thanks for the wonderful package.  I had to do some aggregations
the other day and my other solutions were
running for hours, but data.table finished in a couple of minutes!


More information about the datatable-help mailing list