Learn R Programming

slanter (version 0.2-0)

oclust: Hierarchically cluster ordered data.

Description

Given a distance matrix for sorted objects, compute a hierarchical clustering preserving this order. That is, this is similar to hclust with the constraint that the result's order is always 1:N.

Usage

oclust(distances, method = "ward.D2", order = NULL, members = NULL)

Arguments

distances

A distances object (as created by stats::dist).

method

The clustering method to use (only ward.D and ward.D2 are supported).

order

If specified, assume the data will be re-ordered by this order.

members

Optionally, the number of members for each row/column of the distances (by default, one each).

Value

A clustering object (as created by hclust).

Details

If an order is specified, assumes that the data will be re-ordered by this order. That is, the indices in the returned hclust object will refer to the post-reorder data locations, **not** to the current data locations.

This can be applied to the results of slanted_reorder, to give a "plausible" clustering for the data.

Examples

Run this code
# NOT RUN {
clusters <- slanter::oclust(dist(mtcars), order=1:dim(mtcars)[1])
clusters$order
# }

Run the code above in your browser using DataLab