rholiday: Create a recurring holiday

View source: R/rholiday.R

rholidayR Documentation

Create a recurring holiday

Description

rholiday() is used to create custom holidays. It wraps up a holiday name and its corresponding rschedule into a holiday object with special properties.

Holiday objects can be tweaked with hol_rename(), hol_observe(), and hol_offset(), and they can be added to a calendar with rcalendar().

Usage

rholiday(rschedule, name)

Arguments

rschedule

⁠[rschedule]⁠

The recurrence schedule that determines when the holiday occurs.

name

⁠[character(1)]⁠

The name of the holiday. This serves as a unique identifier when adding multiple holidays to an rcalendar().

Examples

on_christmas <- yearly() %>%
  recur_on_month_of_year("Dec") %>%
  recur_on_day_of_month(25)

# Bundle a holiday name with its recurrence schedule to create a holiday
rholiday(on_christmas, "Christmas")

# This is how the built in holiday objects are created
hol_christmas()

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