Report statistics from summary tables inline
Usage
# S3 method for class 'gtsummary'
inline_text(x, variable, level = NULL, column = NULL, pattern = NULL, ...)
Arguments
- x
(
gtsummary
)
gtsummary object- variable
(
tidy-select
)
A single variable name of statistic to present- level
(
string
)
Level of the variable to display for categorical variables. Default isNULL
- column
(
tidy-select
)
Column name to return fromx$table_body
.- pattern
(
string
)
String indicating the statistics to return. Usesglue::glue()
formatting. Default isNULL
- ...
These dots are for future extensions and must be empty.
column + pattern
Some gtsummary tables report multiple statistics in a single cell,
e.g. "{mean} ({sd})"
in tbl_summary()
or tbl_svysummary()
.
We often need to report just the mean or the SD, and that can be accomplished
by using both the column=
and pattern=
arguments. When both of these
arguments are specified, the column argument selects the column to report
statistics from, and the pattern argument specifies which statistics to report,
e.g. inline_text(x, column = "stat_1", pattern = "{mean}")
reports just the
mean from a tbl_summary()
. This is not supported for all tables.