Learn R Programming

DataExplorer (version 0.2.4)

BarDiscrete: Create bar charts for discrete features

Description

This function creates frequency bar charts for each discrete feature.

Usage

BarDiscrete(data, na.rm = TRUE, maxcat = 50)

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.

Details

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

Examples

Run this code
# load packages
library(ggplot2)
library(data.table)

# load diamonds dataset from ggplot2
data("diamonds")

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

Run the code above in your browser using DataLab