Descriptive statistics for continuous variables, with the option of stratifying by a categorical variable.
proc_means(df, vars = NULL, var_order = NULL, by = NULL, n = T,
mean = TRUE, sd = TRUE, min = TRUE, max = TRUE, median = FALSE,
q1 = FALSE, q3 = FALSE, iqr = FALSE, nmiss = FALSE,
nobs = FALSE, p = FALSE, p_round = 4, display_round = 3)A data.frame with columns variable, by variable, and
a column for each summary statistic.
A data frame or tibble.
Character vector of numeric variables to generate descriptive
statistics for. If the default (NULL), all variables are included,
except for any specified in by.
Character vector listing the variable names in the order
results should be displayed. If the default (NULL), variables are
displayed in the order specified in vars.
Discrete variable. Separate statistics will be produced for
each level. Default NULL provides statistics for all observations.
logical. Display number of rows with values. Default TRUE.
logical. Display mean value. Default TRUE.
logical. Display standard deviation. Default TRUE.
logical. Display minimum value. Default TRUE.
logical. Display maximum value. Default TRUE.
logical. Display median value. Default FALSE.
logical. Display first quartile value. Default FALSE.
logical. Display third quartile value. Default FALSE.
logical. Display interquartile range. Default FALSE.
logical. Display number of missing values. Default FALSE.
logical. Display total number of rows. Default FALSE.
logical. Calculate p-value across by groups using aov.
Ignored if no by variable specified. Default FALSE.
Number of decimal places p-values should be rounded to.
Number of decimal places displayed values should be rounded to
proc_means(iris, vars = c("Sepal.Length", "Sepal.Width"))
proc_means(iris, by = "Species")
Run the code above in your browser using DataLab