calc_target_week_end_date: Calculate end date for the week a forecast is targeting.

View source: R/date_management.R

calc_target_week_end_dateR Documentation

Calculate end date for the week a forecast is targeting.

Description

Following https://github.com/reichlab/covid19-forecast-hub/blob/master/data-processed/README.md, "For week-ahead forecasts with forecast_date of Sunday or Monday of EW12, a 1 week ahead forecast corresponds to EW12 and should have target_end_date of the Saturday of EW12." This means that if horizon is 1, the forecast week end date is set to Saturday of EW12 (the current week) for Sunday and Monday of EW12, and Saturday of EW13 (the next week) for Tuesday through Saturday of EW12.

Usage

calc_target_week_end_date(forecast_date, horizon)

Arguments

forecast_date

character vector of dates in 'yyyy-mm-dd' format

horizon

number of weeks ahead a prediction is targeting

Value

character vector of dates in 'yyyy-mm-dd' format


reichlab/covidHubUtils documentation built on Feb. 6, 2024, 1:42 p.m.