describe: Calculate descriptive statistics

Description Usage Arguments Value Examples

View source: R/descriptive-utils.R

Description

This function is a lightweight wrapper to dplyr's summarize function. It can be used to calculate any descriptive or summary statistic for any variable in the data set. Optionally, a by grouping variable can be used, and then the summary statistics are calculated for each subgroup defined by the different values of the by variable.

Usage

1

Arguments

data

A data frame

by

A grouping variable. If included, the data will be grouped by the values of the by variable before the summary statistics are applied.

...

Arguments of functions applied to variables, e.g. avg = mean(x).

Value

A tibble data frame with each row providing descriptive statistics for selected variables for each value of the grouping by variable.

Examples

1
2
describe(faithfulfaces, avg = mean(faithful), stdev = sd(faithful))
describe(faithfulfaces, by = face_sex, avg = mean(faithful), stdev = sd(faithful))

psyntur documentation built on Sept. 15, 2021, 5:07 p.m.