plot_discrete_vars: Plot Discrete Variables

Description Usage Arguments Value Author(s) Examples

View source: R/plot_discrete_vars.R

Description

Creates a grid of bar plots for variables with at most nvalues (15 is the default) different values.

Usage

1
plot_discrete_vars(x, nvalues = 15, sort_by_frequency = FALSE)

Arguments

x

Data frame, tibble or matrix with data.

nvalues

Integer. It creates a bar plot for each variable with at most this amount of different values. The default value is 15.

sort_by_frequency

Logical. It casts every variable to factor and then reorders the levels by frequency before generating the plot.

Value

A GGplot object.

Author(s)

Guillermo Basulto-Elias

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(glancedata)

plot_discrete_vars(mtcars)
plot_discrete_vars(mtcars, sort_by_frequency = TRUE)
plot_discrete_vars(iris)

## The following two examples give a warning because they don't
## have any variable with fewer than 15 different values.
plot_discrete_vars(cars)
plot_discrete_vars(state.x77)

glancedata documentation built on Dec. 1, 2019, 1:22 a.m.