i_rle | R Documentation |
This is an iterator equivalent of rle; it produces one output
value for each run if identical values in its input, along with the
lenght of the run. i_rle_inverse()
performs the inverse
transformstion.
i_rle(obj, cmp = identical, ...)
i_rleinv(obj, ...)
obj |
An iterable |
cmp |
A function to use for comparison. It should take two
arguments and return |
... |
further arguments forwarded to |
An iterator returning entries of the form list(length=n, value=X)
.
i_rleinv
recreates the original data from the output of i_rle
.
Peter Meilstrup
i_dedupe
it <- isample(c(TRUE, FALSE), 1, replace=TRUE)
rle <- i_rle(it)
x <- take(rle, 10)
as.logical(i_rleinv(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.