proc_means {describedata} | R Documentation |
Replica of SAS's PROC MEANS
Description
Descriptive statistics for continuous variables, with the option of stratifying by a categorical variable.
Usage
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)
Arguments
df |
A data frame or tibble. |
vars |
Character vector of numeric variables to generate descriptive
statistics for. If the default ( |
var_order |
Character vector listing the variable names in the order
results should be displayed. If the default ( |
by |
Discrete variable. Separate statistics will be produced for
each level. Default |
n |
logical. Display number of rows with values. Default |
mean |
logical. Display mean value. Default |
sd |
logical. Display standard deviation. Default |
min |
logical. Display minimum value. Default |
max |
logical. Display maximum value. Default |
median |
logical. Display median value. Default |
q1 |
logical. Display first quartile value. Default |
q3 |
logical. Display third quartile value. Default |
iqr |
logical. Display interquartile range. Default |
nmiss |
logical. Display number of missing values. Default |
nobs |
logical. Display total number of rows. Default |
p |
logical. Calculate p-value across |
p_round |
Number of decimal places p-values should be rounded to. |
display_round |
Number of decimal places displayed values should be rounded to |
Value
A data.frame with columns variable, by
variable, and
a column for each summary statistic.
Examples
proc_means(iris, vars = c("Sepal.Length", "Sepal.Width"))
proc_means(iris, by = "Species")