Learn R Programming

JBTools (version 0.7.2.9)

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

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

Value

for each single element

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.

See Also

seqLongest