rcalendar: Create a recurring calendar

View source: R/rcalendar.R

rcalendarR Documentation

Create a recurring calendar

Description

rcalendar() creates a calendar filled with holidays created from one of the existing ⁠hol_*()⁠ holidays (such as hol_christmas()) or from a manually generated holiday created using rholiday(). That calendar can then be used as an rschedule with any other ⁠alma_*()⁠ function (like alma_in()), or with one of the specialized calendar functions, like cal_match() or cal_events().

Usage

rcalendar(...)

Arguments

...

⁠[rholidays]⁠

One or more holidays created from rholiday() or ⁠hol_*()⁠.

Examples

on_earth_day <- yearly() %>%
  recur_on_month_of_year("April") %>%
  recur_on_day_of_month(22) %>%
  rholiday("Earth Day")

cal <- rcalendar(
  hol_christmas(),
  on_earth_day,
  hol_us_independence_day()
)

cal

cal_events(cal, year = 2020:2022)

# Lookup holiday name based on date, if it exists
cal_match(c("2021-12-25", "2021-12-26"), cal)

# Find next holiday
alma_next("2021-12-26", cal)

almanac documentation built on April 14, 2023, 12:23 a.m.