cutree-methods | R Documentation |
Cut out a clustering level from a cluster hierarchy
## S4 method for signature 'AggExResult'
cutree(tree, k, h)
## S4 method for signature 'APResult'
cutree(tree, k, h)
tree |
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 |
The function cutree
extracts a clustering level from a
cluster hierarchy stored in an AggExResult
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
ExClust
is returned instead of an index list.
The function cutree
may further be used to convert an
APResult
object into an
ExClust
object. In this case, the arguments
k
and h
are ignored.
returns an object of class ExClust
Ulrich Bodenhofer and Andreas Kothmeier
https://github.com/UBod/apcluster
Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btr406")}.
AggExResult
,
ExClust
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.