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 tbl_summary
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
# S3 method for tbl_svysummary
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
# S3 method for tbl_continuous
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
# S3 method for tbl_custom_summary
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
Object with class tbl_summary
from the tbl_summary function,
object with class tbl_svysummary
from the tbl_svysummary function,
object with class tbl_continuous
from the tbl_continuous function or
object with class tbl_custom_summary
from the tbl_custom_summary function.
Not used
Logical indicator to display overall column last in table.
Default is FALSE
, which will display overall column first.
String indicating the column label. Default is "**Overall**, N = {N}"
Override the statistic argument in initial tbl_*
function.
call. Default is NULL
.
Override the digits argument in initial tbl_*
function
call. Default is NULL
.
A tbl_*
of same class as x
Example 1
Example 2
Example 3
Other tbl_summary tools:
add_n.tbl_summary()
,
add_p.tbl_summary()
,
add_q()
,
add_stat_label()
,
bold_italicize_labels_levels
,
inline_text.tbl_summary()
,
inline_text.tbl_survfit()
,
modify
,
separate_p_footnotes()
,
tbl_custom_summary()
,
tbl_merge()
,
tbl_split()
,
tbl_stack()
,
tbl_strata()
,
tbl_summary()
Other tbl_svysummary tools:
add_n.tbl_summary()
,
add_p.tbl_svysummary()
,
add_q()
,
add_stat_label()
,
modify
,
separate_p_footnotes()
,
tbl_merge()
,
tbl_split()
,
tbl_stack()
,
tbl_strata()
,
tbl_svysummary()
Other tbl_continuous tools:
add_p.tbl_continuous()
,
tbl_continuous()
Other tbl_custom_summary tools:
continuous_summary()
,
proportion_summary()
,
ratio_summary()
,
tbl_custom_summary()
# \donttest{
# Example 1 ----------------------------------
tbl_overall_ex1 <-
trial %>%
tbl_summary(include = c(age, grade), by = trt) %>%
add_overall()
# Example 2 ----------------------------------
tbl_overall_ex2 <-
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 ----------------------------------
tbl_overall_ex3 <-
trial %>%
tbl_continuous(
variable = age,
by = trt,
include = grade
) %>%
add_overall(last = TRUE)
# }