textshape (version 1.6.0)

change_index: 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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab