[R] Finding an order for an hclust (dendrogram) object without intersections

Tal Galili
Sun, 13 Jun 2010 14:13:02 -0000

Hello all,

I manually created an hclust object.
Now I am looking to reorder the leafs so they won't intersect with each
other, and would be happy for advises on how to do that.

Here is an example code:


#-------------------------------------
a <- list()  # initialize empty object
# define merging pattern:
#    negative numbers are leaves,
#    positive are merged clusters (defined by row number in $merge)
a$merge <- matrix(c(-1, -2,
                    -3, -4,
                     1,  2,
 -5,-6,
 3,4), nc=2, byrow=TRUE )
a$height <- c(1, 1.5, 3,4,4.5)    # define merge heights
a$order <- c(1,4,2,3,6,5)              # order of leaves(trivial if
hand-entered)
a$labels <- 1:6# LETTERS[1:4]    # labels of leaves
class(a) <- "hclust"        # make it an hclust object
plot(a)                     # look at the result

#-------------------------------------

A working order solution in this example would be 1:6.
The question is how can I find it.


Thanks,
Tal







----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

	[[alternative HTML version deleted]]