Learn R Programming

splusTimeDate (version 2.5.0-137)

holidays: Holiday Generating Function

Description

Generates a collection of holidays.

Usage

holidays(years, type = "USFederal", move = FALSE)

Arguments

years
the years for which to generate holidays.
type
the names of holidays to generate.
move
a logical value. If TRUE, move the holidays to the nearest weekday.

Value

returns a time/date object containing the specified holidays, in chronological order. The time of day in the returned value is midnight in the time zone given by timeDateOptions("time.zone").

Details

This function calls the holiday.xxx functions, where xxx takes on the value of each of the strings in the type argument. If these functions do not exist, an error occurs.

After calling the holiday.xxx functions, holidays calls holiday.nearest.weekday if move is TRUE. This moves the holidays so they occur on weekdays. move can also be given as a logical vector, in which case each element applies to the corresponding element of type.

See Also

holiday.AllSaints, holiday.nearest.weekday, holiday.fixed.

Examples

Run this code
## Generate Christmas, New Years, and Veterans day, moving Christmas 
## and New Years to the nearest weekday 
holidays(1994:2005, c("Christmas", "NewYears", "Veterans"),  
	 c(TRUE, TRUE, FALSE)) 

Run the code above in your browser using DataLab