contemporaryPhy: prune tree and data to lineages present in a time bin in the...

Description Usage Arguments Value Author(s) References Examples

View source: R/contemporaryPhy.R

Description

the function takes a full tree and returns a pruned phylogeny with only tips and lineages found within a time bin preserved. If trait data are supplied the function will return tip states based either on the original tips found in the bin, or tip states inferred from ancestral states

Usage

1
2
3
4
5
6
7
8
9
contemporaryPhy(
  phy,
  maxBin,
  minBin,
  reScale = 0,
  allTraits,
  closest.min = TRUE,
  traits.from.tip = TRUE
)

Arguments

phy

An object of class phylo (see ape).

maxBin

the start age (older time in myr from present) of the time bin in which lineages are preserved

minBin

the final age (younger time in myr from present) of the time bin in which lineages are preserved

reScale

if the most recent tip is not from the present, the age needed to add so the phylogeny is in 'real time'

allTraits

a vector of trait data corresponding to the phy$edge object. The trait data represent tip and internal node data for the phylogeny

closest.min

Logical. Should new tip values for lineages that span the bin be taken from the node nearest the minBin age (closest.min=TRUE, default) or the maxBin age closest.min=FALSE

traits.from.tip

Logical. Should tip values for pendant edges in the bin be taken from the original tip value or the reconstructed node value (if it is closer than the tip value)

Value

the pruned phylogeny. The object descendants refers to the lineages the branch in the time bin gave rise to before it was pruned. If traits are included a vector of trait values representing species at the tips.

Author(s)

Mark Puttick

References

Puttick, M. N., Kriwet, J., Wen, W., Hu, S., Thomas, G. H., & Benton, M. J. (2017). Body length of bony fishes was not a selective factor during the biggest mass extinction of all time. Palaeontology, 60, 727-741.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## prune a random tree to taxa present between 4 and 2 units before present
# generate tree
set.seed(20)
tree <- rtree(20)
# generate traits
traits <- rnorm(20)
# plot tree and timeframe
plot(tree)
max.age <- nodeTimes(tree)[1,1]
abline(v=max.age - c(4, 2))
# prune tree to timeframe
cont.tree <- contemporaryPhy(phy=tree, maxBin=4, minBin=2, allTraits=traits)
plot(cont.tree$phy)

PuttickMacroevolution/motmot documentation built on June 5, 2020, 7 p.m.