When you want to remove/merge consecutive grouping to one, such as combining consecutive survey year to one. Is there a simpler way to do this?

remove_consecutive(x, keep_first = TRUE)

Arguments

x

vector of integer