proc_means: Replica of SAS's PROC MEANS

Description Usage Arguments Value Examples

View source: R/proc_means.R

Description

Descriptive statistics for continuous variables, with the option of stratifying by a categorical variable.

Usage

1
2
3
4
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 (NULL), all variables are included, except for any specified in by.

var_order

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.

by

Discrete variable. Separate statistics will be produced for each level. Default NULL provides statistics for all observations.

n

logical. Display number of rows with values. Default TRUE.

mean

logical. Display mean value. Default TRUE.

sd

logical. Display standard deviation. Default TRUE.

min

logical. Display minimum value. Default TRUE.

max

logical. Display maximum value. Default TRUE.

median

logical. Display median value. Default FALSE.

q1

logical. Display first quartile value. Default FALSE.

q3

logical. Display third quartile value. Default FALSE.

iqr

logical. Display interquartile range. Default FALSE.

nmiss

logical. Display number of missing values. Default FALSE.

nobs

logical. Display total number of rows. Default FALSE.

p

logical. Calculate p-value across by groups using aov. Ignored if no by variable specified. Default FALSE.

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

1
2
proc_means(iris, vars = c("Sepal.Length", "Sepal.Width"))
proc_means(iris, by = "Species")

craigjmcgowan/helpR documentation built on Sept. 2, 2020, 5:59 p.m.