The statistic argument specifies the statistics presented in the table. The
input is a list of formulas that specify the statistics to report. For example,
statistic = list(age ~ "{mean} ({sd})")
would report the mean and
standard deviation for age; statistic = list(all_continuous() ~ "{mean} ({sd})")
would report the mean and standard deviation for all continuous variables.
A statistic name that appears between curly brackets
will be replaced with the numeric statistic (see glue::glue).
For categorical variables the following statistics are available to display.
{n}
frequency
{N}
denominator, or cohort size
{p}
formatted percentage
{n_unweighted}
unweighted frequency
{N_unweighted}
unweighted denominator
{p_unweighted}
unweighted formatted percentage
For continuous variables the following statistics are available to display.
Unlike tbl_summary()
, it is not possible to pass a custom function.
For both categorical and continuous variables, statistics on the number of
missing and non-missing observations and their proportions are available to
display.
{N_obs}
total number of observations
{N_miss}
number of missing observations
{N_nonmiss}
number of non-missing observations
{p_miss}
percentage of observations missing
{p_nonmiss}
percentage of observations not missing
{N_obs_unweighted}
unweighted total number of observations
{N_miss_unweighted}
unweighted number of missing observations
{N_nonmiss_unweighted}
unweighted number of non-missing observations
{p_miss_unweighted}
unweighted percentage of observations missing
{p_nonmiss_unweighted}
unweighted percentage of observations not missing
Note that for categorical variables, {N_obs}
, {N_miss}
and {N_nonmiss}
refer
to the total number, number missing and number non missing observations
in the denominator, not at each level of the categorical variable.