Learn R Programming

spacodiR (version 0.13.0115)

phy.deresolve: collapse phylogenetic nodes into multichotomies

Description

collapses phylogenetic dichotomies within a temporal range into multichotomies

Usage

phy.deresolve(phy, time.range = c(0, 0), relative = TRUE)

Arguments

phy
a phylogenetic tree of class phylo; see read.tree
time.range
a supplied temporal range, within which nodes will be collapsed
relative
whether relative branch lengths are used (e.g., root is 1; present is 0)

Value

phylo

Details

If time.range is supplied as a single value, phy.deresolve will assume that the user intended a range whose minimum is zero (i.e., present; see Examples below). If no nodes are present within the supplied time.range, the tree will be returned unadulterated.

Examples

Run this code
data(sp.example)
attach(sp.example)

## An example with an internal temporal bin
# arbitrarily transform tree to a root age of 100
phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))

# collapse nodes within the middle half of the tree's history
mulphy=phy.deresolve(phy=phy, time.range=c(0.05, 0.95))

# compare result with original tree
plot(mulphy, show.tip.label=FALSE)
mtext("multifurcations in the middle nine-tenths")
dev.new()
plot(phy, show.tip.label=FALSE)
mtext("original phylogeny")

## An example with time.range given by a single value
mulphy=phy.deresolve(phy=phy, time.range=0.25) # affects the most recent quarter of the tree
dev.new()
plot(mulphy, show.tip.label=FALSE)
mtext("multifurcations in the most recent quarter")

## An example showing effect of 'relative'
phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))
dev.new()
plot(dd<-phy.deresolve(phy=phy, time.range=c(0,1), relative=FALSE))
mtext("relative = FALSE")
dev.new()
plot(rr<-phy.deresolve(phy=phy, time.range=c(0,1), relative=TRUE))
mtext("relative = TRUE")



Run the code above in your browser using DataLab