powered by
Prepares distance matrix data for heatmap visualization by handling missing values and calculating relevant statistics.
prepare_heatmap_data( distance_matrix, cluster_rows = FALSE, cluster_cols = FALSE )
A list of data prepared for generating a heatmap of the distance matrix:
The distance matrix, potentially reordered by clustering.
matrix
An integer vector of the row indices after clustering. If cluster_rows is FALSE, this is the original order.
cluster_rows
FALSE
An integer vector of the column indices after clustering. If cluster_cols is FALSE, this is the original order.
cluster_cols
A list of summary statistics for the distance matrix, including mean, sd, min, max, and completeness.
mean
sd
min
max
completeness
Square symmetric matrix of distances
Logical; whether to cluster rows
Logical; whether to cluster columns
# 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)
Run the code above in your browser using DataLab