Learn R Programming

DataExplorer (version 0.2.4)

CorrelationDiscrete: Create correlation heatmap for discrete features

Description

This function creates a correlation heatmap for all discrete categories.

Usage

CorrelationDiscrete(data, maxcat = 20, ...)

Arguments

data
input data to be plotted, in either data.frame or data.table format.
maxcat
maximum categories allowed for each feature. The default is 20.
...
other arguments to be passed to cor.

Details

The function first transposes all discrete categories into columns with binary outcomes (see model.matrix), then calculates the correlation matrix (see cor) and plots it.

Examples

Run this code
# correlation of discrete categories from diamonds dataset
library(ggplot2)
data(diamonds)
CorrelationDiscrete(diamonds)

Run the code above in your browser using DataLab