[R] cut.dendrogram and cutree

Yaomin Xu yaomin at case.edu
Sun Oct 28 22:14:30 CET 2007


Agus,

we use cut.tree when it makes sense to use a specific h as a global
criterion to split the tree.

In your case, you might want to access the tree using '[['. Examples
below borrow the samples you provided in your code:

1) There are two branches in your dend1. To get the left branch, you can do

> dend1.1 <- dend1[[1]]
> labels(dend1.1)

where labels function gives you all the states you have under that branch.

2) There are two big sub-branches on the right branch of brand1, to
access the right one of those two sub-branches, you can do,

dend1.2.2 <- dend1[[c(2,2)]]  # or dend1.2.2<- dend1[[2]][[2]]
lables(dend1.2.2)  ## will list you all the members.

So the branches of a dendrogram object can be accessed in a binary
tree fashion, use '1' for the tree on the left and '2' for the tree on
the right.

hope the above helps.

yaomin

------
Yaomin Xu
Statstical Computing and Bioinformatics
The Cleveland Clinic Foundation



More information about the R-help mailing list