[R-sig-phylo] Collapsing nodes using node.labels

Emmanuel Paradis emmanuel.paradis at ird.fr
Wed Sep 28 16:10:55 CEST 2011


Hello Daniel,

Try this small manipulation ('tr' is your tree and 'node' stores the label of the node): 

i <- which(tr$node.label == node)
j <- which(tr$edge[, 2] == i + Ntip(tr))
tr$edge.length[j] <- 0

Then di2multi(tr) will do the job. (Hopefully, there's originally no zero-length branch in tr.)

HTH

Emmanuel
-----Original Message-----
From: Daniel Rafael Miranda-Esquivel <dmiranda at uis.edu.co>
Sender: r-sig-phylo-bounces at r-project.org
Date: Wed, 28 Sep 2011 00:21:43 
To: <r-sig-phylo at r-project.org>
Subject: [R-sig-phylo] Collapsing nodes using node.labels

 Hello all,


I am trying to collapse some nodes in a tree but using node.label and
not  edge.length, is there a way to convert  node.label to
edge.length? or a function to collapse a node but using node.label
directly?


Daniel

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo



More information about the R-sig-phylo mailing list