prepare_heatmap_data {topolow}R Documentation

Generate Distance Matrix Heatmap Data

Description

Prepares distance matrix data for heatmap visualization by handling missing values and calculating relevant statistics.

Usage

prepare_heatmap_data(
  distance_matrix,
  cluster_rows = FALSE,
  cluster_cols = FALSE
)

Arguments

distance_matrix

Square symmetric matrix of distances

cluster_rows

Logical; whether to cluster rows

cluster_cols

Logical; whether to cluster columns

Value

A list of data prepared for generating a heatmap of the distance matrix:

matrix_data

The distance matrix, potentially reordered by clustering.

row_order

An integer vector of the row indices after clustering. If cluster_rows is FALSE, this is the original order.

col_order

An integer vector of the column indices after clustering. If cluster_cols is FALSE, this is the original order.

stats

A list of summary statistics for the distance matrix, including mean, sd, min, max, and completeness.

Examples

# Create a sample distance matrix
dist_mat <- matrix(runif(25), 5, 5)

# Prepare data for a heatmap
heatmap_data <- prepare_heatmap_data(dist_mat)
print(heatmap_data$stats$completeness)


[Package topolow version 1.0.0 Index]