[R] Any functions to manipulate (merge, cut, remove) hclust objects? (maybe through phylo?)

Martin Maechler maechler at stat.math.ethz.ch
Wed Dec 29 12:49:09 CET 2010

>>>>> Tal Galili <tal.galili at gmail.com>
>>>>>     on Wed, 29 Dec 2010 13:32:26 +0200 writes:

    > Hello Martin,
    > Thank you for replying.

    > I have two needs:

    > 1) To merge two dendrograms into one.

    > 2) To then run cutree on it (which works on hclust, but
    >    not on dendrogram).

Well, but cut() does and is prominently mentioned on the
dendrogram help page (and its examples)

    > I guess that if I knew how to perform both steps I would be able to do what
    > I'm trying to do on my data.
    > If nothing like this currently exists, I guess I'll simply implement a
    > method of cutree for a dendrogram, and see how to merge two dendrograms
    > together.

so you only need to program the merge / join part.

I did not take the time to understand what exactly you mean with
that, but as there is no function to do that with "hclust" either,
I'm convinced you should rather write one for "dendrogram"
indeed; as merge() is already "S3 generic", I'd call it

If you end up finding it useful and are willing to write a help
page (including examples!) for it, you may consider donating it
back to the R-project ... ;-)

Regards, Martin

More information about the R-help mailing list