timeSequence
object.
timeSequence() timeSequence(from, to, by, length.out, k.by=1, align.by=F, extend=F, week.align=NULL, holidays=timeDate(), exceptions, additions, format, zone )
from
,
to
,
by
, and
length.out
must be supplied.
timeDate
object (or number or
character string representing one).
timeDate
object (or number or
character string representing one).
timeSpan
,
timeRelative
, or
numeric
value,
in which case
k.by
is ignored.
Alternatively, it can be one
of the following character strings:
"milliseconds"
,
"seconds"
,
"minutes"
,
"hours"
,
"days"
,
"weekdays"
,
"bizdays"
,
"weeks"
,
"months"
,
"quarters"
,
or
"years"
, giving the
time units of intervals between values in the sequence.
by
. Ignored if
by
is not a character string.
T
, adjust the sequence so that each element is on a whole number
of the
by * k.by
units; e.g., if the units are 2 months, make the sequence
be only on the first of January, March, etc. Ignored if
by
is not a character string.
T
and
align.by
is also
T
, instead of making the entire sequence lie
between
from
and
to
, instead make it extend just past
from
and
to
to the next aligned values. E.g., if
from
is January 15th and the sequence
is by 1 month units, if
extend
is
F
the sequence will start on
February 1st, and if it is
T
, January 1st. Ignored if
by
is not a character string.
by
is
"weeks"
,
you can supply a character
string (or a number, 0 to 6 with 0 being Sunday)
to specify a weekday to use. The character string must
be sufficient to make a unique case-insensitive match to the strings
in
options("time.day.name")
.
The sequence is then adjusted so that all its elements fall on the
given weekday; if
align.by
is
T
, then it will also be adjusted
to start at midnight. In either case,
the
extend
argument is used to decide which
direction to adjust the day. This argument is ignored if
by
is not a character string, or if it
is not
"weeks"
.
by
is not
a character string).
timeSeq
function is very similar, except that it returns a
time/date vector; this function returns a compact time sequence
object that retains information about the sequence.
timeSequence("1/1/1992", "12/1/1992", by = "months") timeSequence("1/3/1992", "12/5/1992", by = "months", align.by=T) timeSequence("1/1/1992", "1/31/1992", by = "weeks", align.by=T, week.align="Mon") timeSequence("1/1/1992", "12/31/1992", by="weekdays", exceptions=holidays(1992)) timeSequence("1/1/1992", "1/1/1995", by="months", exceptions=timeEvent("1/1/1993", "12/31/1993"))