Learn R Programming

DataExplorer (version 0.4.0)

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, order_bar = TRUE)

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.

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 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