index_runs: Run length encoding with indices

View source: R/index_runs.R

index_runsR Documentation

Run length encoding with indices

Description

Run length encoding with indices

Usage

index_runs(x, zero_index = FALSE)

Arguments

x

vector of values on which to perform run length encoding

zero_index

logical. Should indices be indexed from zero (useful for Rcpp)?

Value

A data frame with information about the runs and start/stop indices

Examples


x <- c(
  FALSE, TRUE, FALSE, FALSE, FALSE, TRUE,
  FALSE, TRUE, TRUE, FALSE, TRUE, FALSE,
  FALSE, FALSE, FALSE, FALSE, TRUE, TRUE,
  FALSE, TRUE
)
head(index_runs(x))

PAutilities documentation built on Aug. 21, 2022, 9:05 a.m.