create.calendar {bizdays}R Documentation

Creates calendars


create.calendar creates calendars and stores them in the calendar register.


  holidays = integer(0),
  weekdays = NULL, = NULL, = NULL,
  adjust.from = adjust.none, = adjust.none,
  financial = TRUE



calendar's name. This is used to retrieve calendars from register.


a vector of Dates which contains the holidays


a character vector which defines the weekdays to be used as non-working days (defaults to NULL which represents an actual calendar). It accepts: sunday, monday, thuesday, wednesday, thursday, friday, saturday. Defining the weekend as nonworking days is weekdays=c("saturday", "sunday").

the date which the calendar starts

the date which the calendar ends


is a function to be used with the bizdays's from argument. That function adjusts the argument if it is a nonworking day according to calendar.

is a function to be used with the bizdays's to argument. See also adjust.from.


is a logical argument that defaults to TRUE. This argument defines the calendar as a financial or a non financial calendar. Financial calendars don't consider the ending business day when counting working days in bizdays. bizdays calls for non financial calendars are greater than financial calendars calls by one day.


The arguments and can be set but once they aren't and holidays is set, is defined to min(holidays) and to max(holidays). If holidays isn't set is set to '1970-01-01' and to '2071-01-01'.

weekdays is controversial but it is only a sequence of nonworking weekdays. In the great majority of situations it refers to the weekend but it is also possible defining it differently. weekdays accepts a character sequence with lower case weekdays ( sunday, monday, thuesday, wednesday, thursday, friday, saturday). This argument defaults to NULL because the default intended behavior for create.calendar returns an actual calendar, so calling create.calendar(name="xxx") returns a actual calendar named xxx. (for more calendars see Day Count Convention) To define the weekend as the nonworking weekdays one could simply use weekdays=c("saturday", "sunday").

The arguments adjust.from and are used to adjust bizdays' arguments from and to, respectively. These arguments need to be adjusted when nonworking days are provided. The default behavior, setting adjust.from=adjust.previous and, works like Excel's function NETWORKDAYS, since that is fairly used by a great number of practitioners.

Calendars register

Every named calendar is stored in a register so that it can be retrieved by its name (in calendars). bizdays' methods also accept the calendar's name on their cal argument. Given that, naming calendars is strongly recommended.

See Also

calendars, bizdays


# ANBIMA's calendar (from Brazil)
cal <- create.calendar("Brazil/ANBIMA", holidays=holidaysANBIMA, weekdays=c("saturday", "sunday"))

# ACTUAL calendar
cal <- create.calendar("Actual")

# named calendars can be accessed by its name
bizdays('2016-01-01', '2016-03-14', 'Actual')

[Package bizdays version 1.0.8 Index]