Description Usage Arguments Value Examples
new_rholiday() constructs a new rholiday object. An rholiday is an
rschedule that can be used with any almanac function, like
almanac::alma_events(). rholidays can also be added to rcalendars through
add_rholiday().
1 2 3 4 5 6 7 8 | new_rholiday(
name,
since,
until,
generator,
adjust_on = NULL,
adjustment = NULL
)
|
name |
A required name for the holiday. |
since |
The lower bound on where to begin looking for the holiday. |
until |
The upper bound on where to end looking for the holiday. |
generator |
A function that generates an rschedule for the holiday. The function
takes two arguments, |
adjust_on |
If Otherwise, an rschedule that defines when an adjustment should be made.
For example, set to an rschedule for "on weekends", and
supply an |
adjustment |
If Otherwise, an adjustment function to apply to problematic dates. Typically
one of the pre-existing adjustment functions, like
|
A rholiday.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(almanac)
thanksgiving_generator <- function(since, until) {
yearly(since = since, until = until) %>%
recur_on_ymonth("November") %>%
recur_on_wday("Thursday", nth = 4)
}
thanksgiving <- new_rholiday(
name = "thanksgiving",
since = "1950-01-01",
until = "1980-01-01",
generator = thanksgiving_generator
)
thanksgiving
alma_events(thanksgiving)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.