bin_edge_lengths: Edge-lengths present in time-bins

Description Usage Arguments Details Value Author(s) Examples

View source: R/bin_edge_lengths.R

Description

Given a time-scaled tree and set of time bin boundaries will sum the edge-lengths present in each bin.

Usage

1
bin_edge_lengths(time_tree, time_bins, pruned_tree = NULL)

Arguments

time_tree

A time-scaled tree in phylo format with a $root.time value.

time_bins

A vector of ages in millions of years of time bin boundaries in old-to-young order.

pruned_tree

A time-scaled tree in phylo format with a $root.time value that is a subset of time_tree.

Details

Calculates the total edge duration of a time-scaled tree present in a series of time bins. This is intended as an internal function for rate calculations, but may be of use to someone.

The option of using a pruned_tree allows the user to correctly classify internal and terminal branches in a subtree of the larger tree. So for example, if taxa A and B are sisters then after pruning B the subtree branch leading to A is composed of an internal and a terminal branch on the complete tree.

Value

binned_edge_lengths

A vector giving the summed values in millions of years for each time bin. Names indicate the maximum and minimum values for each time bin.

binned_terminal_edge_lengths

As above, but counting terminal edges only.

binned_internal_edge_lengths

As above, but counting internal edges only.

Author(s)

Graeme T. Lloyd graemetlloyd@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create a random 10-taxon tree:
time_tree <- ape::rtree(n = 10)

# Add root age:
time_tree$root.time <- max(diag(ape::vcv(time_tree)))

# Create time bins:
time_bins <- seq(from = time_tree$root.time, to = 0, length.out = 11)

# Get edge lengths for each bin:
bin_edge_lengths(time_tree = time_tree, time_bins = time_bins)

Claddis documentation built on Oct. 23, 2020, 8:04 p.m.