Generate a unique identifier for consecutive combinations
Generate a unique identifier for consecutive combinations
consecutive_id() generates a unique identifier that increments every time a variable (or combination of variables) changes. Inspired by data.table::rleid().
consecutive_id(...)
Arguments
...: Unnamed vectors. If multiple vectors are supplied, then they should have the same length.
Returns
A numeric vector the same length as the longest element of ....