You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Thetreestats R package contains rapid, C++ based, functions tocalculate summary statistics on phylogenies. For some functions (but not all, see below), thephylogenies are required to be ultrametric and/or binary.
Getting started
Installation
To get started, you can either install from CRAN or use the latestversion from GitHub:
install.packages("treestats") # install from CRAN# use the devtools package to install latest version from GitHub:install.packages("devtools")devtools::install_github("thijsjanzen/treestats")
Basic usage
Given a tree (for example a simulated tree, as in the code example), youcan either access individual statistics, or calculate all currentlyimplemented statistics:
For all of these statistics, the package provides Rcpp versions that aremuch, much faster than their R sister functions. Furthermore, someadditional functions have been improved as well:
ape::branching.times
DDD::phylo2L
DDD::L2phylo
C++ Library
For the Rcpp improved summary statistics (excluding statistics that relyon the calculation of eigen values, as these rely on the Rcppindependent Eigen code), R independent C++ code is provided in theinst/include folder. These can be independently linked by adding thetreestats package in the DESCRIPTION in both the LinkingTo and Dependsfields. Then, in your package, you can also calculate these functions.
Please note that for all functions, there are two versions available: 1)based on input of a phylo object, which is typically one 2-column matrixcontaining all edges, and a vector containing the edge lengths(depending on which information is required to calculate the statistic).2) based on input of an Ltable (Lineage table), which is a 4-columnmatrix containing information on each species, being 1) birth time, 2)parent species, 3) species label and 4) death time (or -1 if extant).
Ltable input can be useful when summary statistics are required for morecomplicated simulation models.