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

From: Tal Galili <tal.galili_at_gmail.com>
Date: Sun, 13 Jun 2010 17:13:02 +0300

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.

```#-------------------------------------
```

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_at_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]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 13 Jun 2010 - 14:16:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 Jun 2010 - 16:50:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.