A vector of class Date, or a character vector in a
format that is understood by as.Date, or anything that
can be coerced to class Date by as.Date (e.g.
POSIXt).
shift
integer
Author
Enrico Schumann
Details
is_weekend checks whether a given date is a Saturday or Sunday.
previous_businessday takes a Datex and
returns the last non-weekend day before. When shift is less
than -1, the function evaluates to the shift-th previous
day. When shift is 0, the function will return x if it
is a business day, else the previous business
day. next_businessday works analogously. There are shorter-named
versions next_bday and prev_bday.
References
B.D. Ripley and K. Hornik. Date-Time Classes. R-News,
1(2):8--12, 2001.