Learn R Programming

bizdays (version 0.1.5)

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 = "actual", weekdays = NULL, dib = 365,
  adjust.from = adjust.next, adjust.to = adjust.previous)

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 NULL which represents an actual calendar)
dib
a single numeric variable which indicates the amount of days within a year (dib stands for days in base and defaults to 365).
adjust.from
bizdays from argument adjustment
adjust.to
bizdays to argument adjustment

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