The function is adapted from the rle function for computing the lengths and values of runs of equal values in a vector -- or the reverse operation.

seqle(x)

Arguments

x

Vector of integers

Value

A list with two components:

lengthsAn integer vector containing the length of each run.
valuesa vector of the same length as lengths with the corresponding values.

References

https://stackoverflow.com/questions/8400901/group-integer-vector-into-consecutive-runs/8402950#8402950