I'm trying to add a footnote to a row label of a gtsummary table, but I can't figure out how to reference the exact cell I want.
Intended output
Usint the default trial dataset, I'd like to add a footnote to "Drug B" that reads "i.e. placebo":
| Characteristic | N = 200¹ |
|---|---|
| Chemotherapy Treatment | |
| __ Drug A | 98 (49%) |
| __ Drug B² | 102 (51%) |
| ¹ n (%) | |
| ² i.e. placebo |
I've tried converting to a gt table and then using tab_footnote() and cells_stub(), but I don't know how to use row = to reference the specific row label I want.
Unfortunately the documentation example for cells_stub() only uses its default locations = everything() argument value.
library(gtsummary)
library(gt)
trial["trt"] |>
tbl_summary() |>
as_gt() |>
tab_footnote(footnote = "i.e. placebo",
# Line below doesn't work
locations = cells_stub(rows = "Drug B"))
