Determine lengths of sequences of identical elements

Description

The function returns a vector indicating the length of sequences of identical elements or elements of an identical type in a vector.

Usage

1
seqLength(array_in, funct.seq = is.na)

Arguments

array_in

numeric: input vector

funct.seq

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

Details

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.

Value

numeric vector of the same length as the input vector indicating the gap length for each single element

Author(s)

Jannis v. Buttlar

See Also

seqLongest