Question Details

No question body available.

Tags

r gtsummary

Answers (1)

June 7, 2026 Score: 5 Rep: 13,020 Quality: Medium Completeness: 80%

Here's an example adding an asterix and also adding a note via a proper footnote as well.

library(gtsummary)

table tblsummary( by = trt, include = c(marker, age), missing = "no" ) |> addn("{pmiss}", collabel = "% Missing")

create a vector of variable names with missing rate >5% (there are plenty of ways to get this and this is just one example)

variablesbigmissing cards::unlistardcolumns() |> dplyr::filter(statname == "pmiss", stat > 0.05) |> dplyr::pull(variable)

tablefinal # add a star for variables with missing rate larger than %5 modifytablebody( ~ .x |> dplyr::mutate(label = ifelse(variable %in% .env$variablesbigmissing & rowtype == "label", paste0(label, "*"), label)) ) |> # or you can do it via a proper footnote modifyfootnotebody( footnote = "Missing rate > 5%", columns = "label", rows = variable %in% .env$variablesbigmissing & row_type == "label" )

enter image description here Created on 2026-06-07 with reprex v2.1.1