# NOT RUN {
df <- data.table(
x = 1:5,
y = c("a", "a", "a", "b", "b")
)
df %>%
mutate.(group_id = cur_group_id.(),
.by = y)
df %>%
mutate.(group_rows = cur_group_rows.(),
.by = y)
# }
Run the code above in your browser using DataLab