| change_index {textshape} | R Documentation |
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.
change_index(x, ...)
x |
A vector. |
... |
ignored. |
Returns a vector of integer indices of where a vector initially changes.
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)