In the table below, how can I but the groups in an additional column on the left (without duplicating the "A" and "B"), so that the table only has 4 rows instead of 6?
library(gt)
library(dplyr, warn.conflicts = FALSE)
test <- data.frame(
group = c("A", "A", "B", "B"),
year = c(1, 2, 1, 2),
value = c(8:11)
)
test |>
group_by(group) |>
gt()
>Solution :
test |>
group_by(group) |>
gt() |>
tab_options(row_group.as_column = TRUE)

