tbl_continuous {gtsummary} | R Documentation |
Summarize a continuous variable
Description
Summarize a continuous variable by one or more categorical variables
Usage
tbl_continuous(
data,
variable,
include = everything(),
digits = NULL,
by = NULL,
statistic = NULL,
label = NULL
)
Arguments
data |
A data frame |
variable |
Variable name of the continuous column to be summarized |
include |
variables to include in the summary table. Default is |
digits |
List of formulas specifying the number of decimal places to round continuous summary statistics. If not specified, an appropriate number of decimals to round statistics will be guessed based on the the variable's distribution. |
by |
A column name (quoted or unquoted) in |
statistic |
List of formulas specifying types of summary statistics
to display for each variable. The default is
|
label |
List of formulas specifying variables labels,
e.g. |
Value
a gtsummary table
Example Output
Example 1
Example 2
See Also
Review list, formula, and selector syntax used throughout gtsummary
Other tbl_continuous tools:
add_overall()
,
add_p.tbl_continuous()
Examples
# Example 1 ----------------------------------
tbl_continuous_ex1 <-
tbl_continuous(
data = trial,
variable = age,
by = trt,
include = grade
)
# Example 2 ----------------------------------
tbl_continuous_ex2 <-
tbl_continuous(
data = trial,
variable = age,
include = c(trt, grade)
)