Holiday Generating Functions

DESCRIPTION:

Generate holidays that occur on fixed dates ( holiday.fixed) or on given weekdays of given months ( holiday.weekday.number), e.g. 1st Monday in September.

USAGE:

holiday.fixed(years, month, day) 
holiday.weekday.number(years, month, weekday, index) 

REQUIRED ARGUMENTS:

years
the desired year(s) to generate holidays for (e.g. 1997:2000).
month
the month of the holiday (1-12).
day
the day of the month of the holiday (1-31).
weekday
the weekday of the holiday (0-6, 0 is Sunday).
index
the occurrence of weekday in the month (1-5, or -1 for last) for the holiday.

VALUE:

a time/date object containing the specified holiday in the specified years.

DETAILS:

The holiday.fixed function generates holidays, like Christmas, that occur on a specified date every year. The holiday.weekday.number function generates holidays that occur on an indexed weekday of a given month every year, such as Labor day in the U.S., which is the first Monday of September. Years in which the given dates do not exist (e.g. 5th Friday in various months) will be excluded from the output (as opposed to generating NA).

SEE ALSO:

, ,

EXAMPLES:

# Generate Christmas 
holiday.fixed(1994:2005, 12, 25) 
# Generate Memorial Day (last Monday in May) 
holiday.weekday.number(1994:2005, 5, 1, -1) 
# Generate Thanksgiving (4th Thursday in November) 
holiday.weekday.number(1994:2005, 11, 4, 4)