sequence
Create A Vector of Sequences
Description
Creates a vector with concatenated sequences.
Usage
sequence(nvec)
Arguments
nvec |
an integer vector. If an element is not an integer, it is
coerced to integer.
|
Value
returns a vector of concatenated sequences:
c(seq_len(nvec[1]), seq_len(nvec[2]), ...).
Differences between TIBCO Enterprise Runtime for R and Open-source R
sequence(NULL) and sequence(integer(0)) both return integer(0) in TIBCO Enterprise Runtime for R, but return NULL in open-source R.
See Also
Examples
sequence(c(4, 2, 6)) # Result: 1 2 3 4 1 2 1 2 3 4 5 6
Pet <- c("Cat", "Cat", "Dog", "Dog", "Dog")
data.frame(Pet, WhereInRun=sequence(rle(Pet)$lengths))