Learn R Programming

mdir (version 0.9.0)

prepDataForggHeatmap: Prepare data for ggplot heatmap

Description

Converts a matrix to the correct format for heatmapping in ``ggplot2`` with an option to order rows and columns.

Usage

prepDataForggHeatmap(
  X,
  row_order = NULL,
  col_order = NULL,
  x_axis = "Feature",
  y_axis = "Item"
)

Value

A long data.frame containing columns `Feature` (the x-axis position of the entry for geom_tile()), `Item` (the y-axis position of the entry for geom_tile()), and `Entry` (value in similarity matrix).

Arguments

X

Matrix.

row_order

Order for rows to be represented in heatmap along the y-axis. Can be ``NULL`` (order defined on data using `hierarchical clustering), ``FALSE`` (no ordering applied), or a vector of indices.

col_order

Order for columns to be represented in heatmap along the x-axis. Can be ``NULL`` (order defined on data using `hierarchical clustering), ``FALSE`` (no ordering applied), or a vector of indices.

x_axis

The name for the column defining the x-axis. Defaults to ``"Feature"``.

y_axis

The name for the column defining the y-axis. Defaults to ``"Item"``.