since <- "2000-01-01"
until <- "2010-01-01"
on_christmas <- yearly(since = since, until = until) %>%
recur_on_month_of_year("Dec") %>%
recur_on_day_of_month(25)
# All Christmas dates, with no adjustments
alma_events(on_christmas)
on_weekends <- weekly(since = since, until = until) %>%
recur_on_weekends()
# Now all Christmas dates that fell on a weekend are
# adjusted either forwards or backwards, depending on which
# non-event date was closer
on_adj_christmas <- radjusted(on_christmas, on_weekends, adj_nearest)
alma_events(on_adj_christmas)
Run the code above in your browser using DataLab