change_index: Indexing of Changes in Runs

change_indexR Documentation

Indexing of Changes in Runs

Description

Find the indices of changes in runs in a vector. This function pairs well with split_index and is the default for the indices in all split_index functions that act on atomic vectors.

Usage

change_index(x, ...)

Arguments

x

A vector.

...

ignored.

Value

Returns a vector of integer indices of where a vector initially changes.

See Also

split_index

Examples

set.seed(10)
(x <- sample(0:1, 20, TRUE))
change_index(x)
split_index(x, change_index(x))


(p_chng <- change_index(CO2[["Plant"]]))
split_index(CO2[["Plant"]], p_chng)

trinker/textshape documentation built on April 5, 2024, 11:39 a.m.