The tab_row_group() function

Use gtcars to create a gt table and use tab_row_group() to add two row groups with the labels: numbered and NA. The row group with the NA label ends up being rendered without a label at all.

gtcars |>
  dplyr::select(model, year, hp, trq) |>
  dplyr::slice(1:8) |>
  gt(rowname_col = "model") |>
  tab_row_group(
    label = "numbered",
    rows = matches("^[0-9]")
  )
year hp trq
numbered
458 Speciale 2015 597 398
458 Spider 2015 562 398
458 Italia 2014 562 398
488 GTB 2016 661 561
GT 2017 647 550
California 2015 553 557
GTC4Lusso 2017 680 514
FF 2015 652 504

Use gtcars to create a gt table. Add two row groups with the labels powerful and super powerful. The distinction between the groups is whether hp is lesser or greater than 600 (governed by the expressions provided to the rows argument).

gtcars |>
  dplyr::select(model, year, hp, trq) |>
  dplyr::slice(1:8) |>
  gt(rowname_col = "model") |>
  tab_row_group(
    label = "powerful",
    rows = hp <= 600
  ) |>
  tab_row_group(
    label = "super powerful",
    rows = hp > 600
  )
year hp trq
super powerful
GT 2017 647 550
488 GTB 2016 661 561
GTC4Lusso 2017 680 514
FF 2015 652 504
powerful
458 Speciale 2015 597 398
458 Spider 2015 562 398
458 Italia 2014 562 398
California 2015 553 557