plot_distributions: Create distribution charts to show in descriptive table

View source: R/cor_tables.R

plot_distributionsR Documentation

Create distribution charts to show in descriptive table

Description

Particularly in exploratory data analysis, it can be instructive to see histograms or density charts.

Usage

plot_distributions(
  x,
  var_names = NULL,
  plot_type = c("auto", "histogram", "density"),
  hist_align_y = FALSE,
  plot_theme = NULL
)

Arguments

x

A dataframe - if var_names is NULL, all numeric variables in x will be used, otherwise those included in var_names will be selected

var_names

A named character vector with the names that should be displayed for variables. If NULL, then the variables are not renamed. Particularly important when output is to be combined with a correlation matrix, e.g., from cor_matrix()

plot_type

Type of plot that should be produced - 'histogram' or 'density' plot. If 'auto', histograms are produced for variables that take fewer than 10 unique values, density plots for others. If a number is provided, that number is used as the maximum number of unique values for which a histogram is used.

hist_align_y

Should histograms use the same y-axis, so that bin heights are comparable? Defaults to FALSE

plot_theme

Additional theme_ commands to be added to each plot

Examples

## Not run: 
plot_distributions(mtcars, var_names = c(wt = "Weight", mpg = "Efficiency",
                   am = "Transmission", gear = "Gears"))

## End(Not run)

LukasWallrich/rNuggets documentation built on Aug. 26, 2022, 11:03 a.m.