holidays: Gets the days corresponding to the holidays

View source: R/calendars.R

holidaysR Documentation

Gets the days corresponding to the holidays

Description

Gets the days corresponding to the holidays

Usage

holidays(
  calendar,
  start,
  length,
  nonworking = c(6, 7),
  type = c("Skip", "All", "NextWorkingDay", "PreviousWorkingDay"),
  single = FALSE
)

Arguments

calendar

The calendar

start

First day of the calendar in the format "YYYY-MM-DD".

length

Length of the calendar.

nonworking

Indexes of non working days (Monday=1, Sunday=7).

type

Adjustment type when a holiday falls a week-end: "NextWorkingDay", "PreviousWorkingDay", "Skip" (holidays corresponding to non working days are simply skipped in the matrix), "All" (holidays are always put in the matrix, even if they correspond to a non working day).

single

boolean indication if a single variable (TRUE) should be return or a matrix (FALSE, the default) containing the different holidays in separate columns.

Value

A matrix where each column is associated to a holiday (in the order of creation of the holiday) and each row to a date.

Examples

belgiumCalendar<-calendar.new()
calendar.fixedday(belgiumCalendar, 7, 21)
calendar.holiday(belgiumCalendar, "NEWYEAR")
calendar.holiday(belgiumCalendar, "CHRISTMAS")
calendar.holiday(belgiumCalendar, "CHRISTMAS", offset=1, weight=.5)
calendar.holiday(belgiumCalendar, "MAYDAY")
calendar.holiday(belgiumCalendar, "EASTERMONDAY")
calendar.holiday(belgiumCalendar, "WHITMONDAY")
calendar.holiday(belgiumCalendar, "ASSUMPTION")
calendar.holiday(belgiumCalendar, "ALLSAINTSDAY")
calendar.holiday(belgiumCalendar, "ARMISTICE")
q<-holidays(belgiumCalendar, "2021-01-01", 365.25*10, type="NextWorkingDay")
plot(apply(q,1, max))

palatej/rjd3modelling documentation built on Jan. 3, 2023, 10:19 p.m.