on_weekends <- weekly() %>%
recur_on_weekends()
# Christmas, adjusted to nearest Friday or Monday if it falls on a weekend
on_christmas <- hol_christmas() %>%
hol_observe(on_weekends, adj_nearest)
# Boxing Day is the day after Christmas.
# If observed Christmas is a Friday, then observed Boxing Day should be Monday.
# If observed Christmas is a Monday, then observed Boxing Day should be Tuesday.
on_boxing_day <- on_christmas %>%
hol_offset(1) %>%
hol_observe(on_weekends, adj_following) %>%
hol_rename("Boxing Day")
christmas_dates <- alma_events(on_christmas, year = 2010:2015)
boxing_day_dates <- alma_events(on_boxing_day, year = 2010:2015)
data.frame(
christmas = christmas_dates,
boxing_day = boxing_day_dates,
christmas_weekday = lubridate::wday(christmas_dates, label = TRUE),
boxing_day_weekday = lubridate::wday(boxing_day_dates, label = TRUE)
)
Run the code above in your browser using DataLab