Description Usage Arguments Details Examples
implements a default left join for data.table
1 2 | ## S3 method for class 'data.tableoff'
x[i, ...]
|
x |
data.table |
i |
object |
By convention DT implements DT[X]
as a RIGHT JOIN. This convention promotes
facts, i.e. the most quickly varying values to be on the RHS of the result.
This is anathema to the convention of modeling where the Y's are expressed
first.
'
1 2 3 4 5 6 7 8 9 10 11 12 | x <- data.table( letters=letters, i=1:26 )
setkey(x, letters )
rhs <- data.table( letters=letters[1:5], i=1:5 )
setkey(rhs, letters )
data.table:::`[.data.table`(x,rhs) # RIGHT JOIN
options( datatable.default.left.join = FALSE )
x[rhs, on=.(letters)] # RIGHT JOIN
options( datatable.default.left.join = TRUE )
x[rhs, on=.(letters)]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.