Learn R Programming

bizdays (version 1.0.4)

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)

following(dates, cal)

adjust.none(dates, cal)

modified.following(dates, cal)

adjust.previous(dates, cal)

preceding(dates, cal)

modified.preceding(dates, cal)

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
# NOT RUN {
cal <- create.calendar("Brazil/ANBIMA", holidaysANBIMA, weekdays=c("saturday", "sunday"))
adjust.next("2013-01-01", "Brazil/ANBIMA")
following("2013-01-01", cal)
modified.following("2016-01-31", cal)
adjust.previous("2013-01-01", cal)
preceding("2013-01-01", cal)
modified.preceding("2016-01-01", cal)
# }

Run the code above in your browser using DataLab