This class is a compact representation of a time/date vector in an arithemetic sequence.
The timeSequence
class extends the positionsCalendar
class.
Valid timeSequence
objects must contain a single non-NA
value in
at least three of the from
, to
, by
, and length
slots.
If all four are present, the length
slot is ignored, and a warning message is generated when
the sequence is used. If length
is present and not being ignored, it must
be non-negative (that is, a zero-length sequence is equivalent to timeDate()
).
Otherwise, to have a valid sequence, adding by
to from
must go
towards to
. The default sequence (generated by calling timeSequence()
or
new("timeSequence")
) has length 0.
A timeSequence
can be coerced to timeDate
using as
,
and regularly-spaced times/dates (or time/date vectors spaced
by regular numbers of months) can be coerced to timeSequence
using as
. This fails if the input is not a regular
sequence within a tolerance given by timeDateOptions("ts.eps")
.
Most operations that work for timeDate
objects also work on timeSequence
objects (for example, mathematical functions, arithmetic,
comparison operators, and subscripting) by first coercing to a time/date
vector. Therefore they do not return timeSequence
objects. Because
of this, it is more efficient to coerce a timeSequence
to timeDate
using as
before performing an extended set of
calculations on the original object, rather than coercing
for each operation.
(timeDate
) the start of the sequence.
(timeDate
) the end of the sequence.
(timeInterval
) the increment for the sequence.
(integer
) the length of the sequence.
(event
) time periods to remove from the sequence.
(positionsCalendar
) times/dates to add to the sequence.
(character
) the time/date output format for sequence display.
(character
) the time zone for the sequence.
timeSequence
function.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.