You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would the API be? The difficult part is that users may want to use the newly created on condition. The evaluation would be easier if we could get users to use a helper function if they want to access the new column in j.
dt[dt,
on = .(date >= list(past_date = date-2),
date <= date),
allow.cartesian = TRUE]
The alternative would be like SQL and have the eval happen twice, once in on and then have users repeat in j
AFAIR bmerge already do shallow copies of data, so adding new columns there would be probably easiest way to achieve that. We just need a proper handling for is.call of LHS and RHS of each element of on argument using internal .parse_on, and then using that in bmerge. The most tricky part can be handling column names well. Eventually we could allow computed columns to be named, the same as we allow in by argument: .(date2 = date >= date-2, date<=date).
Activity
jangorecki commentedon Apr 10, 2016
looks like a duplicate of #625
aryoda commentedon May 4, 2016
Big vote for this enhancement since it makes the syntax of data.table shorter, more intuitive and more SQL alike.
arunsrinivasan commentedon Jun 25, 2016
When done, update:
http://stackoverflow.com/q/37978658/559784
and
https://stackoverflow.com/q/48282827/559784
Henrik-P commentedon Mar 2, 2018
Because Arun started a list with SO posts which may be updated, I thought it I could add some more I stumbled over:
How to merge dataframes of unequal length based on time with buffer intervals in R?
Data.Table non-equi join with arithmetic operations
subset data.frame base on a time interval + or - list of dates
franknarf1 commentedon Oct 20, 2018
To update: https://stackoverflow.com/q/52901099
jaapwalhout commentedon Nov 30, 2018
To update: https://stackoverflow.com/q/53559119/2204410
(or close as a duplicate with one of the links above)
UweBlock commentedon Jun 18, 2019
To update: inner_join() with range of values for one of the keys (year)
ColeMiller1 commentedon Feb 22, 2020
What would the API be? The difficult part is that users may want to use the newly created
oncondition. The evaluation would be easier if we could get users to use a helper function if they want to access the new column inj.The alternative would be like SQL and have the eval happen twice, once in
onand then have users repeat injUweBlock commentedon Mar 8, 2020
To update https://stackoverflow.com/a/60586692/3817004
jangorecki commentedon Jun 27, 2020
AFAIR
bmergealready doshallowcopies of data, so adding new columns there would be probably easiest way to achieve that. We just need a proper handling foris.callof LHS and RHS of each element ofonargument using internal.parse_on, and then using that inbmerge. The most tricky part can be handling column names well. Eventually we could allow computed columns to be named, the same as we allow inbyargument:.(date2 = date >= date-2, date<=date).