add_overall | R Documentation |
Adds a column with overall summary statistics to tables
created by tbl_summary()
, tbl_svysummary()
, tbl_continuous()
or
tbl_custom_summary()
.
add_overall(x, ...)
## S3 method for class 'tbl_summary'
add_overall(
x,
last = FALSE,
col_label = "**Overall** \nN = {style_number(N)}",
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_continuous'
add_overall(
x,
last = FALSE,
col_label = "**Overall** \nN = {style_number(N)}",
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_svysummary'
add_overall(
x,
last = FALSE,
col_label = "**Overall** \nN = {style_number(N)}",
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_custom_summary'
add_overall(
x,
last = FALSE,
col_label = "**Overall** \nN = {style_number(N)}",
statistic = NULL,
digits = NULL,
...
)
x |
( |
... |
These dots are for future extensions and must be empty. |
last |
(scalar |
col_label |
( |
statistic |
( |
digits |
( |
A gtsummary
of same class as x
Daniel D. Sjoberg
# Example 1 ----------------------------------
trial |>
tbl_summary(include = c(age, grade), by = trt) |>
add_overall()
# Example 2 ----------------------------------
trial |>
tbl_summary(
include = grade,
by = trt,
percent = "row",
statistic = ~"{p}%",
digits = ~1
) |>
add_overall(
last = TRUE,
statistic = ~"{p}% (n={n})",
digits = ~ c(1, 0)
)
# Example 3 ----------------------------------
trial |>
tbl_continuous(
variable = age,
by = trt,
include = grade
) |>
add_overall(last = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.