Re: [R-sig-phylo] Adding a taxon to a pre-exisiting tree

2011-04-01 Thread Liam J. Revell
Hi Matthew. I don't doubt that other members of the list have better suggestions, but it is possible to add a tip in all possible places using bind.tree() in ape. For instance, starting with a random unrooted tree with, say, 4 taxa: tree-rtree(n=4,rooted=FALSE,br=rep(1,5)) # create a 5th

Re: [R-sig-phylo] Adding a taxon to a pre-exisiting tree

2011-04-01 Thread Liam J. Revell
Of course, we could generalize my preceding suggestion with the following function: add.everywhere-function(tree,tip.name){ tree-unroot(tree) tree$edge.length-rep(1,nrow(tree$edge)) new.tip-list(edge=matrix(c(2,1),1,2),tip.label=tip.name, edge.length=1,Nnode=1)