Learn R Programming

DataExplorer (version 0.5.0)

plot_bar: Create bar charts for discrete features

Description

This function creates frequency bar charts for each discrete feature.

Usage

plot_bar(data, na.rm = TRUE, maxcat = 50, order_bar = TRUE,
  title = NULL)

Arguments

data

input data to be plotted, in either data.frame or data.table format.

na.rm

logical, indicating if missing values should be removed for each feature. The default is TRUE.

maxcat

maximum categories allowed for each feature. The default is 50. More information in 'Details' section.

order_bar

logical, indicating if bars should be ordered.

title

plot title

Details

If a discrete feature contains more categories than maxcat specifies, it will not be passed to the plotting function.

Examples

Run this code
# NOT RUN {
# load diamonds dataset from ggplot2
data("diamonds", package = "ggplot2")

# plot bar charts for diamonds dataset
plot_bar(diamonds)
plot_bar(diamonds, maxcat = 5)
# }

Run the code above in your browser using DataLab