Getting started

knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(fig.width = 6)
knitr::opts_chunk$set(fig.height = 6)
library(treestats)

Using treestats

The treestats package provides an easy to use interface to calculate summary statistics on phylogenetic trees. To obtain a list of all supported summary statistics use:

list_statistics()

If your favourite summary statistic is missing, please let the maintainer know, treestats is a dynamic package always under development, and the maintainers are always looking for new statistics!

Given a phylogenetic tree, you can now use of the available functions to calculate your summary statistic of choice. Let's take for instance the Colless statistic (and we generate a dummy tree):

phy <- ape::rphylo(n = 100, birth = 1, death = 0.1)

treestats::colless(phy)

Looking at the documentation of the colless statistic (?colless), we find that the function also includes options to normalize for size: either 'pda' or 'yule':

treestats::colless(phy, normalization = "yule")

Multiple statistics

The treestats package supports calculating many statistics in one go. For this, several functions have been set up aptly. Firstly, the function calc_all_stats will calculate all statistics:

all_stats <- calc_all_stats(phy)

Similarly, we can also blanket apply all topology associated summary statistics:

balance_stats <- calc_topology_stats(phy)
unlist(balance_stats)


Try the treestats package in your browser

Any scripts or data that you put into this service are public.

treestats documentation built on Sept. 14, 2024, 9:08 a.m.