rep.rle {rle} | R Documentation |
rep
method for rle
objects## S3 method for class 'rle' rep( x, ..., scale = c("element", "run"), doNotCompact = FALSE, doNotCompress = doNotCompact )
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
|
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).
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")))))