rcalendar: Construct an empty rcalendar

Description Usage Arguments Value Examples

View source: R/rcalendar.R

Description

rcalendar() is the starting point for constructing a new custom calendar. Holidays can be added to it with add_rholiday().

By default, since, until, adjust_on, and adjustment all propagate to holidays added with add_rholiday().

Usage

1
2
3
4
5
6
7
rcalendar(
  name = NULL,
  since = "1900-01-01",
  until = "2100-01-01",
  adjust_on = NULL,
  adjustment = NULL
)

Arguments

name

[NULL / character(1)]

An optional name for the calendar.

since

[Date(1)]

A start date for the rcalendar.

until

[Date(1)]

An end date for the rcalendar.

adjust_on

[NULL / rschedule]

If NULL, no adjustment is made.

Otherwise, an rschedule that defines when an adjustment should be made. For example, set to an rschedule for "on weekends", and supply an adjustment of adj_nearest() to roll holidays that fall on a weekend to the nearest weekday.

adjustment

[NULL / function]

If NULL, no adjustment is made to the holiday.

Otherwise, an adjustment function to apply to problematic dates. Typically one of the pre-existing adjustment functions, like almanac::adj_nearest().

Value

An empty rcalendar.

Examples

1
2
3
4
5
6
7
library(almanac)

cal <- rcalendar() %>%
  add_rholiday(hldy_christmas) %>%
  add_rholiday(hldy_new_years_day)

alma_search("2019-01-01", "2019-12-31", cal)

DavisVaughan/vacation documentation built on May 2, 2020, 11:07 a.m.