View source: R/descriptive-tables.R
create_descriptive_table | R Documentation |
Construct nicely formatted descriptive statistics tables (mean/sd, n/percent).
create_descriptive_table(
df,
continuous = NULL,
discrete = NULL,
multiresponse = NULL,
output = c(names(continuous), names(discrete), names(multiresponse)),
by = NULL,
value_continuous = mean_sd(.mean, .sd, accuracy = 0.1),
value_discrete = n_percent(.n, .proportion),
total = !is.null(by)
)
df |
A data frame containing the variables to describe. |
continuous, discrete |
Character vectors of continuous and discrete variables for which to calculate descriptive statistics. Can be named, in which case the provided names will be used in place of variable names in the first column of the table. |
multiresponse |
List of character vectors, each specifying the individual variables making up a combined multiple-response variable. Should be named, with the names giving the variable names to be used for the combined variables. |
output |
(optional) Character vector of variables to include in the
table (and their order). Elements should be the names of elements of
|
by |
(optional) A grouping variable (as a character string) to split the sample. Default is to report for the entire sample. |
value_continuous |
(optional) An expression describing how to format
the outcome values for continuous variables. Can refer to
mean/sd/min/lq/median/uq/max as |
value_discrete |
(optional) An expression describing how to format the
outcome values for discrete variables. Can refer to n/proportion as
|
total |
(optional) Logical value; should a 'total' (full sample) column
be included? Default is |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.