sum_stats: Summary Statistics

Description Usage Arguments Details Value Examples

View source: R/summary_statistics.R

Description

Calculates the conditional mean, variance, skewness and kurtosis for continuous variables based on a set of quantiles of a given continuous variable.

Usage

1
2
sum_stats(dataset, given_var, stats = c("mean", "var", "skewness",
  "kurtosis"), n_quantiles = 5)

Arguments

dataset

A data frame. Factors and logicals will be removed.

given_var

A named variable from your dataset which you want to set as a condition. The variable name is given as a string.

stats

A vector with the choice of summary statistics you want to print.

n_quantiles

Number of quantiles you want to partition given_var into, with a maximum of 10.

Details

The function will return a list with one entry for each summary statistic. The list entries themselves are matrices. Per default, only conditional means will be displayed. You can choose the statistics you want to print with the input of stats. You can either name the statistics as a choice of stats = c("mean", "var", "skewness", "kurtosis") or as numbers stats = c(1, 2, 3, 4), which represent the corresponding statistics.

Value

A list with one entry for each summary statistic.

Examples

1
2
data(iris)
sum_stats(iris, "Sepal.Length", stats = c("mean", "var"), n_quantiles = 5)

tajohu/GGenemy documentation built on Nov. 5, 2019, 9:44 a.m.