rle2 {accelerometry} | R Documentation |
Run Length Encoding (Alternate Implementation)
Description
Summarizes vector containing runs of repeated values. Very similar to
rle
, but sometimes much faster, and with an option to
return the start/end indices for each run.
Usage
rle2(x, class = NULL, indices = FALSE)
Arguments
x |
Vector (see |
class |
Character string specifying class of |
indices |
Logical value for whether to record start/stop positions in addition to values and lengths for each run. |
Value
Integer or numeric matrix.
Examples
# Create dummie vector x
x <- c(0, 0, 0, -1, -1, 10, 10, 4, 6, 6)
# Summarize x using rle2
x.summarized <- rle2(x)
# Repeat, but also record start/stop indices for each run
x.summarized <- rle2(x = x, indices = TRUE)
[Package accelerometry version 3.1.2 Index]