我试图计算df1中的行数,其中包含事件的日期,
df1 = data.frame(date = c("2021-07-31", "2021-08-01", "2021-08-12", "2021-08-14"))
在df2的开始和结束日期内,
df2 = data.frame(Id = c(1,2),
Start = c("2021-06-01", "2021-08-01"),
End = c("2021-08-15", "2021-09-15"))
在本例中,输出如下所示
Id Start End Count
1 1 2021-06-01 2021-08-15 3
2 2 2021-08-01 2021-09-15 3
我试过How to get the number of counts between two dates in R?和How to get the number of counts between two dates in R?个类似的例子
如有任何帮助或建议,将不胜感激.非常感谢.