cells_row_groups()
Use pizzaplace to create a gt table with grouped data. Add a summary with the summary_rows() function and then add a footnote to the "peppr_salami" row group label with tab_footnote() and with cells_row_groups() in locations.
pizzaplace
summary_rows()
"peppr_salami"
tab_footnote()
locations
pizzaplace |> dplyr::filter(name %in% c("soppressata", "peppr_salami")) |> dplyr::group_by(name, size) |> dplyr::summarize(`Pizzas Sold` = dplyr::n(), .groups = "drop") |> gt(rowname_col = "size", groupname_col = "name") |> summary_rows( columns = `Pizzas Sold`, fns = list(label = "TOTAL", fn = "sum"), fmt = ~ fmt_integer(.) ) |> tab_footnote( footnote = "The Pepper-Salami.", cells_row_groups(groups = "peppr_salami") )