numericSequence class is a compact representation of a
numeric vector in an arithemetic sequence.
numeric) the start of the sequence.
numeric) the end of the sequence.
numeric) the increment for the sequence.
integer) the length of the sequence.
The
numericSequence class extends the
positionsNumeric class.
Valid
numericSequence objects must contain a single non-
NA number in
at least three of the four slots. If all four are present, the
length
slot will be ignored, and a warning message will be generated when
the sequence is used. If
length is present and not being ignored, it must
be non-negative [a zero-length sequence is equivalent to
numeric(0)].
Otherwise, the sign of the
by slot must agree with the sign of
(to - from)
in order to have a valid sequence;
in particular, if
by is zero then
to and
from must be equal. The
default sequence [generated by calling
numericSequence() or
new("numericSequence")
] has length 0.
A
numericSequence can be coerced to
numeric or
integer using
as,
and regularly spaced numbers can be coerced to
numericSequence
using
as, [this will fail if the input is not a regular arithmetic
sequence within a tolerance given by
options("ts.eps")]. Most
operations on
numericSequence objects (e.g. mathematical functions,
arithmetic,
comparison operators, subscripting) work by first coercing to a numeric
vector, and therefore do not return
numericSequence objects.