Closed markfairbanks closed 1 year ago
library(dplyr, w = FALSE) df <- tibble(x = c(1, 2, 2, 1, 1)) df %>% mutate(consecutive_id = consecutive_id(x), rleid = data.table::rleid(x)) #> # A tibble: 5 × 3 #> x consecutive_id rleid #> <dbl> <int> <int> #> 1 1 1 1 #> 2 2 2 2 #> 3 2 2 2 #> 4 1 3 3 #> 5 1 3 3