[R] Help on dendrogram reorder

Adams, Jean
Tue, 02 Apr 2013 15:36:43 -0000

You can define the weights like this ...

order.i.want <- c(3, 6, 7, 4, 5, 2, 8, 9, 1, 10)
wts <- order(order.i.want)
dd.reorder <- reorder(dd, wts, mean)
plot(dd.reorder, main="ordered random dendrogram")

You should cc R-help on all communication ... that way other readers can
follow the thread, and you may get an answer much more quickly to your
query.

Jean



On Fri, Mar 29, 2013 at 11:21 AM, capricy gao <capricyg@yahoo.com> wrote:

> Thank you very much for your reply.
>
> I looked into this and found that this reorder function needs some weight
> information, which is very hard to give. In the provided example,
> ===========>
> set.seed(123)
> x <- rnorm(10)
> hc <- hclust(dist(x))
> dd <- as.dendrogram(hc)
> dd.reorder <- reorder(dd, 10:1)
> plot(dd, main = "random dendrogram 'dd'")
>
>
> =========>
> if I just want to switch 7 2 4 5 to 7 4 5 2, how can I define the weights ?
>
>
>    ------------------------------
> *From:* "Adams, Jean" <jvadams@usgs.gov>
> *To:* capricy gao <capricyg@yahoo.com>
> *Cc:* R help <r-help@r-project.org>
> *Sent:* Monday, March 25, 2013 8:18 AM
> *Subject:* Re: [R] Help on dendrogram reorder
>
>
> On Fri, Mar 22, 2013 at 1:48 PM, capricy gao <capricyg@yahoo.com>
wrote:
>
> as.dendrogram
>
>
> ?reorder.dendrogram
>
> Jean