Generate a sequence of focal dates for chronic msPAF computation
Source:R/chronic.R
expand_focal_dates.RdA thin convenience wrapper around base::seq.Date() for generating the
focal_dates vector passed to time_weighted_aggregate(). The most
common use is a daily sequence for time-series analysis.
Arguments
- start
Start date (character
"YYYY-MM-DD"orDate).- end
End date (character
"YYYY-MM-DD"orDate).- by
Increment. Passed to
base::seq.Date(). Common values:"day","week","month". Default"day".
Examples
# Monthly focal dates across 2024, e.g. to feed time_weighted_aggregate().
expand_focal_dates("2024-01-01", "2024-12-31", by = "month")
#> [1] "2024-01-01" "2024-02-01" "2024-03-01" "2024-04-01" "2024-05-01"
#> [6] "2024-06-01" "2024-07-01" "2024-08-01" "2024-09-01" "2024-10-01"
#> [11] "2024-11-01" "2024-12-01"