apcluster (version 1.4.3)

cutree-methods: Cut Out Clustering Level from Cluster Hierarchy

Description

Cut out a clustering level from a cluster hierarchy

Usage

# S4 method for AggExResult
cutree(tree, k, h)
# S4 method for APResult
cutree(tree, k, h)

Arguments

tree

an object of class containing a cluster hierarchy; may also be an object of class

k

the level (i.e. the number of clusters) to be selected

h

alternatively, the level can be selected by specifying a cut-off for the merging objective

Value

returns an object of class

Details

The function cutree extracts a clustering level from a cluster hierarchy stored in an object. Which level is selected can be determined by one of the two arguments k and h (see above). If both k and h are specified, k overrides h. This is done largely analogous to the standard function cutree. The differences are (1) that only one level can be extracted at a time and (2) that an is returned instead of an index list.

The function cutree may further be used to convert an object into an object. In this case, the arguments k and h are ignored.

References

http://www.bioinf.jku.at/software/apcluster

Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: 10.1093/bioinformatics/btr406.

See Also

,

Examples

Run this code
## create two simple clusters
x <- c(1, 2, 3, 7, 8, 9)
names(x) <- c("a", "b", "c", "d", "e", "f")

## compute similarity matrix (negative squared distance)
sim <- negDistMat(x, r=2)

## run affinity propagation
aggres <- aggExCluster(sim)

## show details of clustering results
show(aggres)

## retrieve clustering with 2 clusters
cutree(aggres, 2)

## retrieve clustering with cut-off h=-1
cutree(aggres, h=-1)

Run the code above in your browser using DataLab