Data.table: New Argument: "join". Objective: ANSI SQL Syntax

Created on 7 Oct 2019  路  4Comments  路  Source: Rdatatable/data.table

Could data.table add a new argument, "join", that instead of using the 'deafult' data.table's own joining syntax, uses that of ANSI SQL.

{r} x[i, j, by, ..., join = 'default']
Where join = c('default', 'left', 'right', 'inner', 'outer').

So that:

  • join = 'left' behaves like X[Y]
  • join = 'inner' behaves like X[Y, nomatch=0]
  • ...

Thank you!

feature request joins

Most helpful comment

For me, it shall be implemented both in the data.table DT[X] Join Syntax, and in merge.data.table.

As DT[X] allows non-equi joins.

As pointed out before, the objective of this is to transform Y[X, join = "left"] to X[Y] :)

All 4 comments

I think if we want to add the new argument, merge.data.table is a better place to have this.

There is a plan to support syntax similar to the one proposed in this issue. I think there is an open issue for that.
@arunsrinivasan had some interesting ideas recently about improving join api.

For me, it shall be implemented both in the data.table DT[X] Join Syntax, and in merge.data.table.

As DT[X] allows non-equi joins.

As pointed out before, the objective of this is to transform Y[X, join = "left"] to X[Y] :)

I vote for this too. Switching the X and Y position to perform left join changes the entire order of columns.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattdowle picture mattdowle  路  3Comments

st-pasha picture st-pasha  路  3Comments

alex46015 picture alex46015  路  3Comments

andschar picture andschar  路  3Comments

franknarf1 picture franknarf1  路  3Comments