rep.rle {rle} | R Documentation |
A rep
method for rle
objects
Description
Usage
## S3 method for class 'rle'
rep(
x,
...,
scale = c("element", "run"),
doNotCompact = FALSE,
doNotCompress = doNotCompact
)
Arguments
x |
an |
... |
see documentation for |
scale |
whether to replicate the elements of the RLE-compressed vector or the runs. |
doNotCompress , doNotCompact |
whether the method should call
|
Note
The rep
method for rle
objects is very limited at
this time. Even though the default setting is to replicate
elements of the vector, only the run-replicating functionality is
implemented at this time except for the simplest case (scalar
times
argument).
Examples
x <- rle(sample(c(-1,+1), 10, c(.7,.3), replace=TRUE))
y <- rpois(length(x$lengths), 2)
stopifnot(isTRUE(all.equal(rep(inverse.rle(x), rep(y, x$lengths)),
inverse.rle(rep(x, y, scale="run")))))
stopifnot(isTRUE(all.equal(rep(inverse.rle(x), max(y)),
inverse.rle(rep(x, max(y), scale="element")))))
[Package rle version 0.9.2 Index]