| prepare_descriptive_table {ExPanDaR} | R Documentation |
Prepares a Table of Descriptive Statistics
Description
Reads a data frame and reports descriptive statistics (n, mean, standard deviation, minimum, first quartile, median, third quartile, maximum) for all members of the data frame that are either numeric or logical.
Usage
prepare_descriptive_table(
df,
digits = c(0, 3, 3, 3, 3, 3, 3, 3),
format = "html"
)
Arguments
df |
Data frame containing at least one variable that is either numeric or logical and at least two observations. |
digits |
Number of decimal digits that you want to be displayed for each column. If you provide NA, then the column is omitted from the output. |
format |
character scalar that is handed over to |
Details
The digits parameter from prepare_descriptive_table() uses the default method of
kable to format numbers, calling round. This implies that trailing zeroes are
just omitted.
Value
A list containing two items.
- "df"
A data frame containing the descriptive table
- "kable_ret"
The return value provided by
kablecontaining the formatted table
Examples
t <- prepare_descriptive_table(mtcars)
t$df