Description Usage Arguments Value Examples
add_rholiday() adds a new holiday to a calendar. To add a holiday, pass
through the corresponding holiday function, without the parenthesis.
add_rholiday() will take care of constructing the rholiday object with
the correct arguments.
Arguments passed on to the rholiday_fn (such as since and adjust_on)
default to the corresponding arguments in the rcalendar, but can be
overridden at the rholiday level by supplying them in add_rholiday().
1 2 3 4 5 6 7 8 9 |
x |
An rcalendar. |
rholiday_fn |
An rholiday function, such as |
... |
Not used. |
since |
If Otherwise, the lower bound on where to begin looking for the holiday. |
until |
If Otherwise, the upper bound on where to begin looking for the holiday. |
adjust_on |
If Otherwise, an rschedule that defines when an adjustment to the holiday
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
|
x, with a new rholiday.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | library(almanac)
cal <- rcalendar() %>%
add_rholiday(hldy_christmas) %>%
add_rholiday(hldy_new_years_day)
cal
alma_in("1999-12-25", cal)
on_weekends <- weekly() %>%
recur_on_weekends()
# Construct a calendar that rolls weekend Christmas dates to
# the nearest weekday
cal2 <- rcalendar() %>%
add_rholiday(
hldy_christmas,
adjust_on = on_weekends,
adjustment = adj_nearest
) %>%
add_rholiday(hldy_new_years_day)
alma_search("2004-01-01", "2010-01-01", cal2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.