When using group_rows function from kableExtra, you can provide a names vector providing the number of rows to group together. auto_index_group_rows compute that index based on a vector by counting the successive identical values of that vector.

auto_index_group_rows(x)

Arguments

x

a vector

Examples

x <- c("a", "a", "a", "b", "b", "a", "c", "c")
auto_index_group_rows(x)
#> a b a c 
#> 3 2 1 2