holidays: Holiday Generating Function

View source: R/holidays.R

holidaysR Documentation

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.

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.

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").

See Also

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

Examples

## 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)) 

splusTimeDate documentation built on July 7, 2022, 5:05 p.m.