This function is most useful for converting a forecast date and an ahead specification from epiweek to days. It allows days as well.
get_target_ahead(forecast_date, incidence_period, ahead)
forecast_date | Date object or string of the form "YYYY-MM-DD",
indicating date on which forecasts will be made about some period (e.g.,
epiweek). For example, if |
---|---|
incidence_period | String indicating the incidence period, either "epiweek" or "day". |
ahead | Vector of (one or more) integers. How many epiweeks/days ahead
are you forecasting? If |
fd <- "2021-03-22" # a monday get_target_ahead(fd, "epiweek", 1) # forecast the following Saturday#> [1] 5get_target_ahead("2021-03-23", "epiweek", 1) # forecast the Saturday after next#> [1] 11get_target_ahead(fd, "day", 1) # forecast tomorrow#> [1] 1