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 = NULL,
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_svysummary'
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_continuous'
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
## S3 method for class 'tbl_custom_summary'
add_overall(
x,
last = FALSE,
col_label = NULL,
statistic = NULL,
digits = NULL,
...
)
x |
Object with class |
... |
Not used |
last |
Logical indicator to display overall column last in table.
Default is |
col_label |
String indicating the column label. Default is |
statistic |
Override the statistic argument in initial |
digits |
Override the digits argument in initial |
A tbl_*
of same class as x
Example 1
Example 2
Example 3
Daniel D. Sjoberg
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()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.