# NOT RUN {
# 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`
tab_1 <-
pizzaplace %>%
dplyr::filter(
name %in% c("soppressata", "peppr_salami")
) %>%
dplyr::group_by(name, size) %>%
dplyr::summarize(
`Pizzas Sold` = dplyr::n()
) %>%
gt(rowname_col = "size") %>%
summary_rows(
groups = TRUE,
columns = vars("Pizzas Sold"),
fns = list(TOTAL = "sum"),
formatter = fmt_number,
decimals = 0,
use_seps = TRUE
) %>%
tab_footnote(
footnote = "The Pepper-Salami.",
cells_row_groups(groups = "peppr_salami")
)
# }
Run the code above in your browser using DataLab