powered by
Generate a unique id for runs of consecutive values
consecutive_id.(...)
Vectors of values
x <- c(1, 1, 2, 2, 1, 1) consecutive_id(x)
Run the code above in your browser using DataLab