• add_rschedule() adds an rschedule to an rbundle. This can be another rrule or another rbundle.

  • add_rdates() adds rdates to an rbundle. rdates are singular special cased dates that are forcibly included in the event set.

  • add_exdates() adds exdates to an rbundle. exdates are singular special cased dates that are forcibly excluded from the event set.

add_rschedule(x, rschedule)

add_rdates(x, rdates)

add_exdates(x, exdates)

Arguments

x

[rbundle]

An rbundle to add to.

rschedule

[rschedule]

An rschedule, such as an rrule or rbundle.

rdates

[Date]

Dates to forcibly include in the rbundle.

exdates

[Date]

Dates to forcibly exclude from the rbundle.

Value

An updated rbundle.

Details

In terms of priority:

  • An exdate will never be included.

  • A rdate will always be included if it is not also an exdate.

  • An event generated from an rschedule will always be included if it is not also an exdate.

Examples

on_thanksgiving <- yearly() %>%
  recur_on_wday("Thurs", 4) %>%
  recur_on_ymonth("Nov")

on_christmas <- yearly() %>%
  recur_on_mday(25) %>%
  recur_on_ymonth("Dec")

on_labor_day <- monthly() %>%
  recur_on_ymonth("Sep") %>%
  recur_on_wday("Mon", 1)

rb <- runion() %>%
  add_rschedule(on_thanksgiving) %>%
  add_rschedule(on_christmas) %>%
  add_rschedule(on_labor_day)

# Thanksgiving, Christmas, or Labor Day
alma_search("2019-01-01", "2021-01-01", rb)
#> [1] "2019-09-02" "2019-11-28" "2019-12-25" "2020-09-07" "2020-11-26"
#> [6] "2020-12-25"

# Except Labor Day in 2019
rb2 <- add_exdates(rb, "2019-09-02")

alma_search("2019-01-01", "2021-01-01", rb2)
#> [1] "2019-11-28" "2019-12-25" "2020-09-07" "2020-11-26" "2020-12-25"