# How to find consecutive TRUE values in a vector and replace them with the amount of consecutive TRUE values in R?

Good morning, I am sure there is an easy way to do this (in fact, I remember having done it in the past, but I do not remember how). I have a logical variable in a dataframe which is compounded by consecutive TRUE and FALSE values: dput(vel) c(FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE,… Read More How to find consecutive TRUE values in a vector and replace them with the amount of consecutive TRUE values in R?