`Maybe this is obvious, but even though your tree is unrooted, node 6 is`

`the "root" of the edge matrix for the tree (i.e., it has the node`

`number equal to Ntip(tree)+1) - thus:`

t5<-multi2di(t5)

will give you a resolved tree rooted at this node.

`There seems to be a bug in root when you try to root an unrooted tree at`

`the "root" node (i.e., the node with node number Ntip(tree)+1).`

All the best, Liam Liam J. Revell, Assistant Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 3/19/2015 3:12 PM, Luiz Max Carvalho wrote:

Dear phylofolks, I'm trying to root a tree on an internal (rather than a terminal) branch. Here is a small example: library(ape) t5 <- rmtree(N = 1, n = 5, rooted = FALSE)[[1]] root(t5, node = 6, resolve.root = TRUE) output: Error in if (i != N) { : argument is of length zero root(t5, node = 7, resolve.root = TRUE) output: Phylogenetic tree with 5 tips and 4 internal nodes. Tip labels: [1] "t4" "t3" "t2" "t5" "t1" Rooted; includes branch lengths. I don't understand why rooting at node 6 throws an error, while using node 7 is fine. What am I missing? Cheers, Luiz

_______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/