Matrix for constructing temporal effects into the nowcast()
.
Usage
temporal_effects(
day_of_week = FALSE,
weekend = FALSE,
day_of_month = FALSE,
month_of_year = FALSE,
week_of_year = FALSE,
holidays = NULL
)
Arguments
- day_of_week
Boolean. Whether to include an effect for each of the seven days of the week.
- weekend
Boolean. Whether to include an effect for the weekend vs the weekday.
- day_of_month
Boolean. Whether to include an effect for the day of the month (i.e. 1 to 31st)
- month_of_year
Boolean. Whether to include an effect for the month.
- week_of_year
Boolean. Whether to include an effect for the epidemiological week.
- holidays
Either
NULL
or analmanac::rcalendar()
specifying how to calculate holidays.
US holidays
US Federal holidays can be passed by just passing the almanac::cal_us_federal()
function
into temporal effects.
Examples
#Create day of week and week of year class
temporal_effects(day_of_week = TRUE, week_of_year = TRUE)
#>
#> ── Temporal effect object ──
#>
#> The following effects are in place:
#> • day_of_week
#> • week_of_year
#>
#Set up a holiday effect on Christmass using the almanac package
if(!requireNamespace("almanac", quietly = TRUE)){
cal <- rcalendar(hol_christmas())
temporal_effects(holidays = cal)
}