[R-sig-phylo] selecting terminal branch lengths?

Liam J. Revell lrevell at nescent.org
Tue Feb 9 04:24:19 CET 2010


Try this:

# given an object of class "phylo" called tree

# 1. create vector for terminal edge lengths
terminal.edges<-matrix(NA,length(tree$tip.label));

# 2. copy terminal branches into vector
terminal.edges<-tree$edge.length[tree$edge[1:(2*length(tree$tip.label)-2),2]<=length(tree$tip.label)]; 


# 3. label terminal branches by tip label
names(terminal.edges)<-tree$tip.label;

I think that should work.

- Liam

Liam J. Revell
NESCent, Duke University
web: http://anolis.oeb.harvard.edu/~liam/
NEW email: lrevell at nescent.org



mgavil2 wrote:
> Dear All
>
> I am trying to find a way to get a vector of only the terminal branch length
> for species in a phylogeny, but cant seem to find a way
>
> any suggestions?
>
> Best,
>
> Maria Mercedes
>



More information about the R-sig-phylo mailing list