Adds a column with overall summary statistics to tables
created by tbl_ard_summary()
.
# S3 method for class 'tbl_ard_summary'
add_overall(
x,
cards,
last = FALSE,
col_label = "**Overall**",
statistic = NULL,
...
)
(tbl_ard_summary
)
A stratified 'gtsummary' table
(card
)
An ARD object of class "card"
typically created with cards::ard_*()
functions.
(scalar logical
)
Logical indicator to display overall column last in table.
Default is FALSE
, which will display overall column first.
(string
)
String indicating the column label. Default is "**Overall**"
(formula-list-selector
)
Override the statistic argument in initial tbl_*
function
call. Default is NULL
.
These dots are for future extensions and must be empty.
A gtsummary
of same class as x
# Example 1 ----------------------------------
# build primary table
tbl <-
cards::ard_stack(
trial,
.by = trt,
cards::ard_continuous(variables = age),
cards::ard_categorical(variables = grade),
.missing = TRUE,
.attributes = TRUE,
.total_n = TRUE
) |>
tbl_ard_summary(by = trt)
# create ARD with overall results
ard_overall <-
cards::ard_stack(
trial,
cards::ard_continuous(variables = age),
cards::ard_categorical(variables = grade),
.missing = TRUE,
.attributes = TRUE,
.total_n = TRUE
)
# add an overall column
tbl |>
add_overall(cards = ard_overall)
Characteristic
Overall1
Drug A1
Drug B1
1 Median (Q1, Q3); n (%)