holidays {TimeWarp} | R Documentation |
Functions for querying and manipulating the TimeWarp holiday database
holidays(years, type, silent = FALSE) addToHolidays(type,dates) registerHolidays(type,dates) unregisterHolidays(type,dates) allHolidays() isHoliday(dates, type)
years |
numeric vector of years for which to return holiday dates. |
type |
character string, name of the holiday. |
dates |
a |
silent |
do not display warnings. |
The TimeWarp holidays database is implemented as an internal named, or type
'd, list of data.frame
's.
To create a new type
of holiday, use registerHolidays
. unregisterHolidays
will delete the holiday named by type
, and addToHolidays
will add new days to an existing type
of holiday.
allHolidays
returns a character vector of all the known holiday type
s.
holidays
returns a Date
vector of holidays that fall within the years
argument for the given holiday type
.
addToHolidays
and registerHolidays
invisibly return a copy of the data.frame
for the given type
.
unregisterHolidays
invisibly returns NULL
.
allHolidays
returns a character vector of all holiday
type
's known to the database.
isHoliday
returns a logical vector with TRUE of all
holidays in input.
isWeekday
, nearestWeekday
, filterWeekdays
# Create a holiday type of New Year days for the 20th century. registerHolidays('NEWYEAR', as.Date(ISOdate(1900:2000,1,1))) # Return all New Year days for the 1990's holidays(1990:2000,'NEWYEAR') # View counts of registered holidays by year sapply(as.character(1998:2012), function(y) sapply(allHolidays(), function(h) length(holidays(y, h, silent=TRUE))))