Determine lengths of sequences of identical elements
The function returns a vector indicating the length of sequences of identical elements or elements of an identical type in a vector.
numeric: input vector
string or name of a function: name of the function to use. Has to return TRUE for elements belonging to the sequence and FALSE otherwise
The function returns a vector of the same length as the input vector indicating for each element in array_in how long the sequence of similar elements this value belongs to id. Zero indicates that identical values (or types) in the neighbourhood of the value. This process helps to indicate for example long gaps in timeseries.
numeric vector of the same length as the input vector indicating the gap length for each single element
Jannis v. Buttlar