index_runs {PAutilities}R 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))

[Package PAutilities version 1.2.1 Index]