How to combine [table_a] and [table_b] as below ? The wished result as [table_c]
the Restrictions are:
table_a$category=table_b$category
and table_a$date %in% range(start_date,end_date)
Anyone can help ? Thanks!
table_a <- data.frame(date=c(44197,44259,44565,44354,44449,44385,44409),
category=c("a","a","a","b","b","c","c")) %>% mutate(date=as.Date(date,'1899-12-30'))
table_b <- data.frame(category=c("a","a","a","b","b","c"),
start_date=c(43466,44288,44563,44197,44416,42736),
end_date=c(44287,44562,52963,44415,52963,52963),
seller=c("Allen","Grece","Lemon","Ally","Sam","Candy")) %>%
mutate(start_date=as.Date(start_date,'1899-12-30'),
end_date=as.Date(end_date,'1899-12-30'))