Learn R Programming

slanter (version 0.2-0)

reorder_hclust: Given a clustering of some data, and some ideal order we'd like to use to visualize it, reorder (but do not modify) the clustering to be as consistent as possible with this ideal order.

Description

Given a clustering of some data, and some ideal order we'd like to use to visualize it, reorder (but do not modify) the clustering to be as consistent as possible with this ideal order.

Usage

reorder_hclust(clusters, order)

Arguments

clusters

The existing clustering of the data.

order

The ideal order we'd like to see the data in.

Value

A reordered clustering which is consistent, wherever possible, the ideal order.

Examples

Run this code
# NOT RUN {
clusters <- hclust(dist(mtcars))
clusters$order
clusters <- slanter::reorder_hclust(clusters, 1:length(clusters$order))
clusters$order
# }

Run the code above in your browser using DataLab