Learn R Programming

bizdays (version 0.1.4)

Calendar: Creates the calendar based on a list of holidays.

Description

Calendar is the main class, it has all attributes necessary to execute business days calculations.

Usage

Calendar(holidays = integer(0), start.date = "1970-01-01",
  end.date = "2071-01-01", name = NULL, weekdays = c("saturday",
  "sunday"))

Arguments

holidays
a vector of Dates which contains the holidays
start.date
the date which calendar starts
end.date
the date which calendar ends
name
calendar's name
weekdays
a character vector which defines the weekdays to be used as non-working days (defaults to weekend c('saturday', 'sunday'))

Examples

Run this code
# holidays has iso-formated dates
data(holidaysANBIMA)
cal <- Calendar(name="ANBIMA", holidays=holidaysANBIMA)
# For empty calendar just pass nothing
cal <- Calendar(name="Weekdays") # from 1970-01-01 to 2071-01-01
# ACTUAL calendar
cal <- Calendar(name="Actual", weekdays=NULL)
# unnamed calendars have NULL names
cal <- Calendar(start.date="1976-07-12", end.date="2013-10-28")
is.null(cal$name) # TRUE

Run the code above in your browser using DataLab