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

Description Usage Arguments Details Value Date types accepted Examples

Description

Rolls the given date to the next or previous business day, unless it is a business day.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

Details

adjust.next and following return the next business day if the given date is not a business day. adjust.previous and preceding are similar, but return the previous business day. modified.following rolls the given date to the next business day, unless it happens in the next month, in this case it returns the previous business day. modified.preceding is similar to modified.following, but rolls the given date to the previous business day.

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

1
2
3
4
5
6
7
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)

Example output

Attaching package: 'bizdays'

The following object is masked from 'package:stats':

    offset

[1] "2013-01-02"
[1] "2013-01-02"
[1] "2016-01-29"
[1] "2012-12-31"
[1] "2012-12-31"
[1] "2016-01-04"

bizdays documentation built on June 26, 2018, 5:03 p.m.