R dplyr join on range of dates

后端 未结 2 1387
抹茶落季
抹茶落季 2021-01-15 15:25

I want to join two tables xxx and yyy using a composite unique key and date ranges. In sql I would simply specify in the join but I cannot get

2条回答
  •  野的像风
    2021-01-15 15:44

    We could use fuzzy_inner_join from fuzzy_join

    library(fuzzy_join)
    fuzzy_inner_join(xxx, yyy,
                  by = c("ID" = "ID",
                               "NRA"="NRA",
                               "date_low" =  "date",
                               "date_high" = "date"), 
                  match_fun = list("==", "==", ">", "<"))
    

提交回复
热议问题