emmanuelparadis / ape

Analysis of Phylogenetics and Evolution
https://emmanuelparadis.github.io/
GNU General Public License v2.0
53 stars 11 forks source link

fix the order of tip in as.hclust.phylo #33

Closed xiangpin closed 3 years ago

xiangpin commented 3 years ago

The order of tip in original as.hclust.phylo might be incorrect.

Original

> library(ape)
> set.seed(123)
> dd <- matrix(abs(rnorm(100)), 10)
> xx <- hclust(as.dist(dd))
> tr <- as.phylo(xx)
> yy <- as.hclust(tr)
> library(ggplotify)
> library(patchwork)
> as.ggplot(~plot(xx)) + as.ggplot(~plot(tr)) + as.ggplot(~plot(yy))

xx

This request

> library(ape)
> set.seed(123)
> dd <- matrix(abs(rnorm(100)), 10)
> xx <- hclust(as.dist(dd))
> tr <- as.phylo(xx)
> yy <- as.hclust(tr)
> library(ggplotify)
> library(patchwork)
> as.ggplot(~plot(xx)) + as.ggplot(~plot(tr)) + as.ggplot(~plot(yy))

xx1

emmanuelparadis commented 3 years ago

Thanks a lot for the fix and the corrected typo!