extractEdges: Function by Dom J. Bennett from MoreTreeTools. Function...

View source: R/extractEdges.R

extractEdgesR Documentation

Function by Dom J. Bennett from MoreTreeTools. Function extracts edges from a phylogeny

Description

Function by Dom J. Bennett from MoreTreeTools. Function extracts edges from a phylogeny

Usage

extractEdges(phylo, taxa, type = 1)

Arguments

phylo

Phylogeny (ape class)

taxa

vector of taxon names

type

Which types of edges to extract, default type='1', type='1' returns phylogeny consisting solely of taxa. type='2' extracts edges from taxon tips to terminal node type='3' extracts edges unique to taxa.

Examples

set.seed(1)
tr <- rtree(7)
txa <- tr$tip.label[3:6]

edgw <- 1:Nedge(tr)
ecols <- rep('black',Nedge(tr))
par(mfrow=c(1,3))

## type=1
ec <- ecols
ec[extractEdges(tr,txa)] = 'red'
plot(tr,edge.color=ec,edge.width=3,main='Type=1')

## type=2
ec <- ecols
ec[extractEdges(tr,txa,type=2)] = 'red'
plot(tr,edge.color=ec,edge.width=3,main='Type=2')

## type=3
ec <- ecols
ec[extractEdges(tr,txa,type=3)] = 'red'
plot(tr,edge.color=ec,edge.width=3,main='Type=3')

reptalex/phylofactor documentation built on Feb. 28, 2024, 3:19 p.m.