plot_sum_stats: Plot Summary Statistics

Description Usage Arguments Details Value Examples

View source: R/plot_sum_stats.R

Description

Calculates the conditional mean, variance, skewness and kurtosis for continuous variables based on a range of quantiles of a given continuous variable and displays them as line plots.

Usage

1
2
plot_sum_stats(dataset, given_var, stats = c(1, 2, 3, 4),
  n_quantiles = 5)

Arguments

dataset

A data frame. Factors and logicals will be removed.

given_var

A variable from your dataset which you want to set as a condition.

stats

Vector of summary statistics you want to plot.

n_quantiles

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

Details

The function will return one plot for each of the chosen summary statistics. The values will be displayed as line plots, each point representing the value of the statistic conditioned on a specific quantile of the given variable.

You can choose the way you indicate which summary statistics you want to plot. One way is to express the stats as numerics (1 = mean, 2 = variance, 3 = skewness, 4 = kurtosis) or as strings in a vector (as a subset of c("mean", "var", "skewness", "kurtosis")).

Value

One plot for each statistic, showing all numeric variables conditioned on the given variable on a grid. The results will open in one window per statistic when using plot_sum_stats() in RStudio.

Examples

1
2
data(iris)
plot_sum_stats(iris, "Sepal.Length", stats = c(1, 2, 3, 4), n_quantiles = 5)

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