50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


bizdays (version 0.2.2)

is.bizday: Checks if the given dates are business days.

Description

Returns TRUE if the given date is a business day and FALSE otherwise.

Usage

is.bizday(dates, cal = bizdays.options$get("default.calendar"))

Arguments

dates
dates to be checked
cal
an instance of Calendar

Value

logical objects informing that given dates are or are not business days.

Date types accepted

The argument dates accepts Date objects and any object that returns a valid Date object when passed through as.Date, which include all POSIX* classes and character objects with ISO formatted dates.

Examples

Run this code
data(holidaysANBIMA)
cal <- Calendar(holidaysANBIMA, weekdays=c("saturday", "sunday"))

is.bizday("2013-01-02", cal)

# Once you have a default calendar set, cal does not need to be provided
bizdays.options$set(default.calendar=cal)

dates <- seq(as.Date("2013-01-01"), as.Date("2013-01-05"), by="day")
is.bizday(dates)

Run the code above in your browser using DataLab