The tab_info() function

Use gtcars to create a gt table. Use the tab_spanner() function to group two columns together under a spanner column with the ID and label "performance". Finally, use the tab_info() function to get a table that summarizes the ID values and their label text for all parts of the table.

gt_tbl <-
  gtcars |>
  dplyr::select(model, year, starts_with("hp"), msrp) |>
  dplyr::slice(1:4) |>
  gt(rowname_col = "model") |>
  tab_spanner(
    label = "performance",
    columns = starts_with("hp")
  )

gt_tbl |> tab_info()
Information on ID and Label Values
ID Idx
Lvl
Label
Columns
model 1 model
year 2 year
hp 3 hp
hp_rpm 4 hp_rpm
msrp 5 msrp
Rows
GT 1 GT
458 Speciale 2 458 Speciale
458 Spider 3 458 Spider
458 Italia 4 458 Italia
Spanners
performance 1 performance