This helper, to be used with
tbl_custom_summary()
, creates a function
summarizing a continuous variable.
continuous_summary(variable)
String indicating the name of the variable to be summarized. This variable should be continuous.
When using continuous_summary
, you can specify in the statistic=
argument
of tbl_custom_summary()
the same continuous statistics than in
tbl_summary()
. See the statistic argument section of the help file of
tbl_summary()
.
Example 1
Other tbl_custom_summary tools:
add_overall()
,
proportion_summary()
,
ratio_summary()
,
tbl_custom_summary()
# \donttest{
# Example 1 ----------------------------------
continuous_summary_ex1 <-
trial %>%
tbl_custom_summary(
include = c("stage", "grade"),
by = "trt",
stat_fns = ~ continuous_summary("age"),
statistic = ~"{median} [{p25}-{p75}]",
overall_row = TRUE,
overall_row_label = "All stages & grades"
) %>%
modify_footnote(
update = all_stat_cols() ~ "Median age (IQR)"
)
# }