/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{
  6. phy.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. \details{
  15. If \code{time.range} is supplied as a single value, \code{phy.deresolve} will assume that the user intended a range whose minimum is
  16. zero (i.e., present; see \strong{Examples} below). If no nodes are present within the supplied \code{time.range}, the tree will be returned unadulterated.}
  17. \value{A phylogenetic tree of class \code{phylo} }
  18. \author{Jonathan Eastman, based on \code{\link[ape]{di2multi}} by Emmanuel Paradis}
  19. \examples{
  20. data(sp.example)
  21. attach(sp.example)
  22. ## An example with an internal temporal bin
  23. # arbitrarily transform tree to a root age of 100
  24. phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))
  25. # collapse nodes within the middle half of the tree's history
  26. mulphy=phy.deresolve(phy=phy, time.range=c(0.05, 0.95))
  27. # compare result with original tree
  28. plot(mulphy, show.tip.label=FALSE)
  29. mtext("multifurcations in the middle nine-tenths")
  30. dev.new()
  31. plot(phy, show.tip.label=FALSE)
  32. mtext("original phylogeny")
  33. ## An example with time.range given by a single value
  34. mulphy=phy.deresolve(phy=phy, time.range=0.25) # affects the most recent quarter of the tree
  35. dev.new()
  36. plot(mulphy, show.tip.label=FALSE)
  37. mtext("multifurcations in the most recent quarter")
  38. ## An example showing effect of 'relative'
  39. phy$edge.length=phy$edge.length*(100/max(branching.times(phy)))
  40. dev.new()
  41. plot(dd<-phy.deresolve(phy=phy, time.range=c(0,1), relative=FALSE))
  42. mtext("relative = FALSE")
  43. dev.new()
  44. plot(rr<-phy.deresolve(phy=phy, time.range=c(0,1), relative=TRUE))
  45. mtext("relative = TRUE")
  46. }