Find regular sequences of integers in numeric vector v.
series(v, step = 1, minseries = 2)
v | A numeric vector containing only whole numbers. |
---|---|
step | The step size and direction (distance between adjacent items) for identifying series. Note that the sign of the step matters. Use positive values for monotonically increasing series and negative values for monotonically decreasing series. Defaults to 1. Use 0 for invariant series (runs). |
minseries | The minimimum series length. Defaults to 2. |
Numeric matrix with 1 row for each series, and three columns indicating:
first: Integer at beginning of series.
runstart: Index into v
for start of series.
runlength: Length of series.
Takes a vector of whole numbers and returns a matrix with 3 columns: (1) integer at beginning of series, (2) index pointing to beginning of series, (3) length of series
David Braze davebraze@gmail.com