Skip to contents

This function takes in a tibble of forecasts or scores and adds the following columns: horizon_days (an integer) and horizon (a string to be used for categorical grouping of horizons)

Usage

add_horizons(
  df,
  target_end_date_col = "target_end_date",
  forecast_date_col = "forecast_date",
  last_data_date_col = "last_hosp_data_date"
)

Arguments

df

A tibble containing either forecasts or scores (or both) and columns corresponding to the target end date, the forecast_date, and the last data date (which defines the boundary between the calibration period and the nowcast period.

target_end_date_col

Name of the column containing target end dates. Default "target_end_date".

forecast_date_col

Name of the column containing forecast dates. Default "forecast_date".

last_data_date_col

column containing last data dates. Default "last_hosp_data_date"

Value

a tibble containing the same columns as df plus horizon_days and horizon