continuous_summary: Summarize a continuous variable

View source: R/utils-tbl_custom_summary.R

continuous_summaryR Documentation

Summarize a continuous variable

Description

\lifecycle

experimental This helper, to be used with tbl_custom_summary(), creates a function summarizing a continuous variable.

Usage

continuous_summary(variable)

Arguments

variable

String indicating the name of the variable to be summarized. This variable should be continuous.

Details

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 Output

Example 1

image of rendered example table

Author(s)

Joseph Larmarange

See Also

Other tbl_custom_summary tools: add_overall(), proportion_summary(), ratio_summary(), tbl_custom_summary()

Examples


# 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)"
  )


ddsjoberg/gtsummary documentation built on Nov. 3, 2023, 11:42 a.m.