I'd like to label the consecutive data points of same property (in this example "TRUE") as different groups (e.g., Group1, Group2, ...).
Below is the example data:
dt <- data.frame(value = c(TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE))
The "group" column is what I want to achive:
value group
TRUE G1
TRUE G1
FALSE <NA>
FALSE <NA>
TRUE G2
FALSE <NA>
TRUE G3
TRUE G3
TRUE G3
TRUE G3