[R] Hclust - Number of branch operations for every element

Lui lui.r.project at googlemail.com
Sun Dec 19 19:13:56 CET 2010


Hello everybody,

I need to know how often every element in an hierarchical cluster was 
"branched" - just imagine a watering pot on the top of the hierarchical 
tree -> the leafs should get water according to the number of branches 
that lie before them.

For example:
a <- list()  # initialize empty object
a$merge <- matrix(c(-1, -2,
                     -3, -4,
                      1,  2,
                      -5,-6,
                      3,4), nc=2, byrow=TRUE )
a$height <- c(1, 2, 3,4,5)
a$order <- c(1,2,3,4,5,6)
a$labels <- 1:6
class(a) <- "hclust"
plot(a)

The leaf "1" has was branched three times -> it would get 1/2^3 = 0.125 
of the "total water". Same for leaf 2.Leafs 3 and 4 would each get the 
same (0.125). Leaf 5 and 6 would get 0.25 -> Adding up to 1.
Does anybody have a clue?
Thanks a lot in advance!
Lui



More information about the R-help mailing list