Join tables by date range [duplicate]
问题 This question already has answers here : Merge 2 dataframes if value within range (4 answers) Closed 3 years ago . I am looking for simple method to join two tables by date range. 1 table contains exact date, another table contains two variables identifying beginning and ending of the time period. I need to join tables if date in first table is withing range from second table. data1 <- data.table(date = c('2010-01-21', '2010-01-25', '2010-02-02', '2010-02-09'), name = c('id1','id2','id3','id4