[datatable-help] datatable-help Digest, Vol 28, Issue 2
Matthew Dowle
mdowle at mdowle.plus.com
Thu Jun 7 19:56:11 CEST 2012
To clear up (hopefully) these points for completeness ...
> So it seems both our mental models are somewhat wrong - for me, Y isn't
> necessarily the larger table, for you Y isn't necessarily the subset.
Perhaps it helps to recall what inspired data.table in the first place:
A[B] syntax in base. See FAQ 2.14. Rightly or wrongly, that's really how
I think about X[Y]; i.e., just like matrix A[B] but extended to more
dimensions each of potentially different type.
> The reason I like thinking in joins is I prefer infix syntax. More
> elegant to me to say setkey(Y, a, b) %lj% setkey(X, a, b) than setkey(X,
> a, b)[setkey(Y, a, b)], and the chaining versus nested is easy as well...
>
> X[Y][Z] => (X %rj% Y) %rj% Z
> X[Y[Z]] => X %rj% (Y %rj% Z)
Interesting. Have you defined these infix aliases yourself and that's how
you use data.table then? How to control the infix op by passing arguments
such as nomatch=0|NA, roll, mult?
> I was wondering what the differences/similarities there were to merge().
See FAQ 1.12: "What is the di
erence between X[Y] and merge(X,Y)?"
Matthew
More information about the datatable-help
mailing list