Learn R Programming

fame (version 1.13)

holidays: Holidays

Description

Functions that know about Federal and FRB (Federal Reserve Board) holidays.

Usage

nextBusinessDay(x, holidays = NULL, goodFriday = F, board = F)
previousBusinessDay(x, holidays = NULL, goodFriday = F, board = F)
isHoliday(x, goodFriday = F, board = F, businessOnly = T)
isGoodFriday(x)
isEaster(x)
holidays(years, goodFriday = F, board = F, businessOnly = T)
federalHolidays(years, board = F, businessOnly = T)
goodFriday(years)
easter(years)
holidaysBetween(startTi, endTi, goodFriday = F, board = F, businessOnly = T)

Arguments

x
a ti time index, or something that can be turned into one, such as a yyyymmdd number or a Date object.
holidays
a vector of holidays (in yyyymmdd form) to skip over, or NULL. In the latter case, the holidays function is used to determine days to skip over.
goodFriday
if TRUE, consider Good Friday as a holiday. Default is FALSE because Good Friday is not a federal holiday.
board
if TRUE, the Friday preceding a Saturday NewYears, Independence, Veterans or Christmas Day is considered a holiday.
businessOnly
if TRUE (the default), ignore Saturday NewYears, Independence, Veterans amd Christmas Day holidays. Has no effect if board is TRUE, since that moves Saturday holidays to Friday.
years
numeric vector of 4 digit years
startTi
a daily ti time index, or something that can be turned into one
endTi
a daily ti time index, or something that can be turned into one

Value

  • nextBusinessDay and previousBusinessDay return "business" frequency ti objects.

    isHoliday, isGoodFriday and isEaster return Boolean vectors as long as x.

    easter and goodFriday return numeric vectors of yyyymmdd dates of the appropiate holidays for each year in the years argument.

    federalHolidays returns a numeric vector of yyyymmdd dates for the federal holidays for each year in years. The names attribute of the returned vector contains the holiday names.

    holidays returns a vector like federalHolidays does. The only difference between the two functions is that holidays has the option of including Good Fridays.

    holidaysBetween returns a vector of yyyymmdd dates for holidays that fall within the time spanned by [startTi, endTi].

Details

Federal law defines 10 holidays. Four of them, NewYears, Independence, Veterans and Christmas, fall on the same date every year. The other six fall on particular days of the week and months (MLK, Presidents, Memorial, Labor, Columbus, and Thanksgiving).

If one of the four fixed-date holidays falls on a Sunday, the federal holiday is celebrated the next day (Monday). If it falls on a Saturday, the preceding day (Friday) is a holiday for the Federal Reserve Board, but not for the Reserve Banks and the banking system as a whole.