Functions for querying and manipulating the TimeWarp holiday database
1 2 3 4 5 6
numeric vector of years for which to return holiday dates.
character string, name of the holiday.
do not display warnings.
The TimeWarp holidays database is implemented as an internal named, or
type'd, list of
To create a new
type of holiday, use
unregisterHolidays will delete the holiday named by
addToHolidays will add new days to an existing
type of holiday.
allHolidays returns a character vector of all the known holiday
holidays returns a
Date vector of holidays that fall within the
years argument for the given holiday
registerHolidays invisibly return a copy of the
data.frame for the given
unregisterHolidays invisibly returns
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.
1 2 3 4 5 6 7 8 9
# 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))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.