on_thanksgiving <- yearly() %>%
recur_on_day_of_week("Thurs", nth = 4) %>%
recur_on_month_of_year("Nov")
on_christmas <- yearly() %>%
recur_on_day_of_month(25) %>%
recur_on_month_of_year("Dec")
on_labor_day <- monthly() %>%
recur_on_month_of_year("Sep") %>%
recur_on_day_of_week("Mon", nth = 1)
# Rather than:
if (FALSE) {
rb <- runion() %>%
add_rschedule(on_thanksgiving) %>%
add_rschedule(on_christmas) %>%
add_rschedule(on_labor_day)
}
# Use the `...` of the `runion()` helper directly:
rb <- runion(on_thanksgiving, on_christmas, on_labor_day)
# Thanksgiving, Christmas, or Labor Day
alma_search("2019-01-01", "2021-01-01", rb)
# Except Labor Day in 2019
# Rather than:
if (FALSE) {
rb2 <- add_exdates(rb, "2019-09-02")
}
# We recommend:
rb2 <- rsetdiff(rb, rcustom("2019-09-02"))
alma_search("2019-01-01", "2021-01-01", rb2)
Run the code above in your browser using DataLab