Dear R-help mailing list (and Emmanuel, the ape package maintainer),

I would like to change a non binary phylo object to hclust, but this does
not seem to work smoothly.

Here is a small R code to demonstrate the problem:

# an hclust tree with 3 branches from the root
hc <- hclust(dist(c(1:2, 4,5, 7,8)), method = "single")
plot(hc)

# we can change it to phylo just fine:
library(ape)
phy <- as.phylo(hc)
plot(phy)
# for some reason it claims the object is binary
is.binary.tree(phy) # TRUE

# it turns to hclust
hc2 <- as.hclust(phy)
# but the plotting fails:
plot(hc2)
# Error in plot.hclust(hc2) : 'merge' matrix has invalid contents
cutree(hc2, 2) # works, but doesn't give any warning that it actually can't
provide with only 2 clusters...



Thanks upfront for any help.

Best,
Tal



----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to