Build Groups of Dates by Difference
group_dates_by_diff(dates, diff_days = 1)
dates | vector of |
---|---|
diff_days | maximum difference between consecutive dates that may occur for dates within the same group |
dates <- as.Date(c("2019-07-01", "2019-07-03", "2019-07-06", "2019-07-08")) fhpredict:::group_dates_by_diff(dates, diff_days = 2)#> from_id to_id from_date to_date n_days #> 1 1 2 2019-07-01 2019-07-03 3 #> 2 3 4 2019-07-06 2019-07-08 3