dateSeq {TimeWarp} | R Documentation |
Generate a sequence of dates. Based on seq.Date
, but adds support for business day and holiday sequencing.
dateSeq()
is a generic, with
methods for character
, Date
, POSIXct
, and POSIXlt
.
dateSeq(from = NULL, to = NULL, year = NULL, by = "days", k.by = 1, length.out = NULL, holidays = NULL, align.by = TRUE, extend = FALSE, range = NULL, week.align = NULL)
from |
starting value of the sequence, a |
to |
ending value of the sequence, a |
year |
an alternative to supplying |
by |
spacing between successive values in the sequence. Can be one of An alternative way to specify |
k.by |
non-zero integer giving the width of the interval between consecutive values in the sequence in terms of the units given in by. |
length.out |
the length of the sequence, before additions and exceptions are included. |
holidays |
character string describing the holidays to exclude from the sequence when |
align.by |
if TRUE, adjust the sequence so that each element is on a whole number of the |
extend |
if TRUE and align.by is also TRUE, instead of making the entire sequence lie between from and to, make it extend just past from and to to the next aligned values. |
range |
a two-element character or |
week.align |
if |
A vector of dates.
The class of the returned value is the same as the class of from
for character
, Date
, POSIXct
, and
POSIXlt
. For from
of other classes, the class of the
returned value is Date
, but this may change in the future.
dateSeq("2008-12-20", "2009-1-10") dateSeq("2008-12-20", "2009-1-10", by = "days", k.by = 2) library(Holidays) dateSeq("2008-12-20", "2009-1-10", by = "bizdays", holidays = "NYSEC") dateSeq(from = "1960-01-01", to = "1960-01-20", by = "weeks", week.align = 0, extend = TRUE) dateSeq(from = "2000/01/14", length.out = 5, by = "bizdays", holidays = 'NYSEC')