Learn R Programming

bizdays (version 0.2.2)

adjust.date: Adjusts the given dates to the next/previous business day

Description

If the given dates are business days it returns the given dates, but once it is not, it returns the next/previous business days.

Usage

adjust.next(dates, cal = bizdays.options$get("default.calendar"))
adjust.previous(dates, cal = bizdays.options$get("default.calendar"))

Arguments

dates
dates to be adjusted
cal
an instance of Calendar

Value

Date objects adjusted accordingly.

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"))
adjust.next("2013-01-01", cal)
adjust.previous("2013-01-01", cal)

Run the code above in your browser using DataLab