PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/spacodiR/man/phy.deresolve.Rd

http://github.com/eastman/spacodiR
Unknown | 55 lines | 46 code | 9 blank | 0 comment | 0 complexity | 0fe0ff6198a0946dba462b373da0bb9f MD5 | raw file
 1\name{phy.deresolve}
 2\alias{phy.deresolve}
 3\title{collapse phylogenetic nodes into multichotomies}
 4\description{collapses phylogenetic dichotomies within a temporal range into multichotomies}
 5\usage{
 6phy.deresolve(phy, time.range = c(0, 0), relative = TRUE)
 7}
 8%- maybe also 'usage' for other objects documented here.
 9\arguments{
10  \item{phy}{a phylogenetic tree of class \code{phylo}; see \code{\link[ape]{read.tree}}}
11  \item{time.range}{a supplied temporal range, within which nodes will be collapsed}
12  \item{relative}{whether relative branch lengths are used (e.g., root is 1; present is 0)}
13
14}
15\details{
16If \code{time.range} is supplied as a single value, \code{phy.deresolve} will assume that the user intended a range whose minimum is 
17zero (i.e., present; see \strong{Examples} below).  If no nodes are present within the supplied \code{time.range}, the tree will be returned unadulterated.}
18\value{A phylogenetic tree of class \code{phylo} }
19\author{Jonathan Eastman, based on \code{\link[ape]{di2multi}} by Emmanuel Paradis}
20\examples{
21data(sp.example)
22attach(sp.example)
23
24## An example with an internal temporal bin
25# arbitrarily transform tree to a root age of 100
26phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))
27
28# collapse nodes within the middle half of the tree's history
29mulphy=phy.deresolve(phy=phy, time.range=c(0.05, 0.95))
30
31# compare result with original tree
32plot(mulphy, show.tip.label=FALSE)
33mtext("multifurcations in the middle nine-tenths")
34dev.new()
35plot(phy, show.tip.label=FALSE)
36mtext("original phylogeny")
37
38## An example with time.range given by a single value
39mulphy=phy.deresolve(phy=phy, time.range=0.25) # affects the most recent quarter of the tree
40dev.new()
41plot(mulphy, show.tip.label=FALSE)
42mtext("multifurcations in the most recent quarter")
43
44## An example showing effect of 'relative'
45phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))
46dev.new()
47plot(dd<-phy.deresolve(phy=phy, time.range=c(0,1), relative=FALSE))
48mtext("relative = FALSE")
49dev.new()
50plot(rr<-phy.deresolve(phy=phy, time.range=c(0,1), relative=TRUE))
51mtext("relative = TRUE")
52
53
54
55}