reindex_clusters: Reindex cluster labels in ascending order

Description Usage Arguments Examples

View source: R/ShinyFunctions.R

Description

Given an hclust object and the number of clusters k this function reindex the clusters inferred by cutree(hc, k)[hc$order], so that they appear in ascending order. This is particularly useful when plotting heatmaps in which the clusters should be numbered from left to right.

Usage

1

Arguments

hc

an object of class hclust

k

number of cluster to be inferred from hc

Examples

1
2
3
hc <- hclust(dist(USArrests), 'ave')
cutree(hc, 10)[hc$order]
reindex_clusters(hc, 10)[hc$order]

SC3 documentation built on Nov. 8, 2020, 7:52 p.m.