Learn R Programming

DiscreteGapStatistic (version 1.1.2)

likert.heat.plot2: Summary Heatmap for categorical data

Description

Heatmap representation summarizing categorical/likert data. Modified version of `likert.heat.plot` from `likert` package. Does not allow different categorical ranges across questions. The function outputs a ggplot object where additional layers can be added for customization purposes. The output plot preserves the question order given by columns of `x`.

Usage

likert.heat.plot2(
  x,
  allLevels,
  low.color = "white",
  high.color = "blue",
  text.color = "black",
  text.size = 4,
  textLen = 50
)

Value

ggplot object.

Arguments

x

matrix object or data.frame with categorical data. Columns are questions and rows are observations.

allLevels

vector with all categorical (ordered) levels.

low.color

string; name of color assigned to the first level found in `allLevels`.

high.color

string; name of color assigned to the last level found in `allLevels`.

text.color

string; text color of numbers within cells.

text.size

string; text size for numbers within cells.

textLen

string; maximum length of text-length for question labels (column names)