Learn R Programming

laser (version 2.4-1)

truncateTree: Truncate a Set of Branching Times

Description

This function is used to truncate a set of branching times derived from a phylogenetic tree. Incomplete taxon sampling causes a spurious decline in the rate of lineage accumulation over time, and this effect becomes more severe towards the present. Likewise, in the absence of dense phylogeographic sampling, it may be desirable to omit the final one or more nodes from the tree. truncateTree permits the user to omit k final nodes, or the final t time units.

Usage

truncateTree(x, omit.time = NULL, omit.nodes = NULL, batch = FALSE)

Arguments

x
a numeric vector of branching times
omit.time
remove the final 'omit.time' time units before present from tree
omit.nodes
remove the final 'omit.nodes' nodes before present
batch
if TRUE, processes batch of branching times. FALSE assumes as single set of branching times

Value

a numeric vector of branching times, or if batch = TRUE, a matrix of branching times.

Details

Consider a set of branching times x = (100, 80, 50, 40, 30, 20, 10, 5). If you wanted to analyze only the first half of the tree, perhaps due to concern about incomplete sampling, calling truncateTree(x, omit.time = 50) would return a vector of branching times x1 = (50, 30, 0). Likewise, if you wished to omit the final 2 branching times, truncateTree(x, omit.nodes = 2) would return x2 = (90, 70, 40, 30, 20). 'batch' implies that you are entering a matrix or dataframe of branching times for multiple trees, as returned by getBtimes.batch. The 'omit.time' option is not available for batch processing.

Examples

Run this code
  data(plethodon)
  pleth2 <- truncateTree(plethodon, omit.nodes = 2)
  #omits final 2 branching times
  
  plotLtt(pleth2)

Run the code above in your browser using DataLab