How to convert a phylogeny to a dendrogram in R I want to convert my phylogeny into a dendrogram so I can use it with dendextend in R to produce a tanglegram. I have made some progress but I keep encountering errors, see below:

library(ape)
library(dendextend)

Tree &lt;- rtree(10, rooted=F)

Tree &lt;- read.tree(file="clipboard", text=NULL) 
# test &lt;- as.dendrogram(Tree) 
## Error in ape::as.hclust.phylo(object) : the tree is not ultrametric

Tree.ultra &lt;- chronos(Tree)  
# test &lt;- as.dendrogram(Tree.ultra) 
## Error in ape::as.hclust.phylo(object) : the tree is not rooted

Tree.ultra$root.edge &lt;- 0
# test &lt;- as.dendrogram(Tree.ultra) 
## Error in ape::as.hclust.phylo(object) : the tree is not binary


This thread seems to be the closest to answering my issues but the workflow is different and Im not sure how to address this binary issue. I have tried using as.hclust, as.hclust.phylo and hclust.
For your example to work you should replace the rtree function with the rcoal function, see example below.

library(ape)  
library(dendextend)   
Tree &lt;- rtree(10, rooted=F)
is.ultrametric(Tree) 
[1] FALSE 
is.binary.tree(Tree) 
[1] TRUE

Tree_rcoal &lt;- rcoal(10, rooted=F) 
is.ultrametric(Tree_rcoal) 
[1] TRUE
is.binary.tree(Tree_rcoal) 
[1] TRUE

Tree_rcoal2 &lt;- rcoal(10, rooted=F)

tanglegram(Tree_rcoal, Tree_rcoal2)


To make use of a file in newick format, you can try to convert with the chronos function.

s &lt;- "owls(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);"
cat(s, file = "ex.tre", sep = "\n")
tree.owls &lt;- read.tree("ex.tre")
is.ultrametric(tree.owls)
[1] FALSE
dendrogram &lt;- chronos(tree.owls)

Setting initial dates...
Fitting in progress... get a first set of estimates
         Penalised log-lik = -24.04992 
Optimising rates... dates... -24.04992 
Optimising rates... dates... -24.04908 

Done.
is.ultrametric(dendrogram)
[1] TRUE