This help topic is for R version 1.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/mva/html/cutree.html
cutree {mva}R Documentation

Cut a tree into groups of data

Description

Cuts a tree, e.g., as resulting from hclust, into several groups either by specifying the desired number of groups or the cut height.

Usage

cutree(tree, k=NULL, h=NULL)

Arguments

tree

a tree as produced by hclust

k

An integer scalar or vector with the desired number of groups

h

A numeric scalar or vector with heights where the tree should be cut.

At least one of k or h must be specified, k overrides h if both are given.

Value

cutree returns an vector with group meberships if k or h are scalar, otherwise a matrix with group meberships is returned where each column corresponds to the elements of k or h, respectively (which are also used as column names).

See Also

hclust

Examples

require(mva)
data(USArrests)

hc <- hclust(dist(USArrests))

cutree(hc, k=2:5)
cutree(hc, h=250)