change_index {textshape}R 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)

[Package textshape version 1.7.5 Index]