The row_group_order() function

Let’s use exibble to create a gt table with a stub and with row groups. We can modify the order of the row groups with row_group_order(), specifying the new ordering in groups.

exibble |>
  dplyr::select(char, currency, row, group) |>
  gt(
    rowname_col = "row",
    groupname_col = "group"
  ) |>
  row_group_order(groups = c("grp_b", "grp_a"))
char currency
grp_b
row_5 NA 1325.810
row_6 fig 13.255
row_7 grapefruit NA
row_8 honeydew 0.440
grp_a
row_1 apricot 49.950
row_2 banana 17.950
row_3 coconut 1.390
row_4 durian 65100.000