FuncDiv_alpha_metrics: List object containing the functions to compute the default...

FuncDiv_alpha_metricsR Documentation

List object containing the functions to compute the default alpha diversity metrics

Description

These functions are used by the alpha_div_contrib function to compute contributional diversity, but can be used for any arbitrary input vector as well to compute standard alpha diversity.

Usage

FuncDiv_alpha_metrics

Format

An object of class list of length 15.

Details

The metrics were primarily taken from definitions provided by scikit-bio Python package, as well as the vegan and picante R packages. The functions are provided as elements of this list, so that it is more convenient to call them programatically. All available alpha diversity metrics can be seen by typing names(FuncDiv_alpha_metrics). The code to compute each metric can be inspected for each function, for instance, for richness, by typing: FuncDiv_alpha_metrics$richness.

These functions all have a single input: a numeric vector containing taxa abundances within a given sample. The exception is for faiths_pd, which expects a character vector of taxa labels that are present, as well as a tree (phylo object), which must contain all these specified taxa labels as tip labels.

Note that not all these metrics are appropriate for relative abundance data. In particular, these metrics expect count data (e.g., read counts) corresponding to the number of occurrences of each category (e.g., each microbe): menhinicks_richness, mcintoshs_evenness, mcintoshs_dominance, margalefs_richness, and fishers_alpha.

Value

numeric vector with alpha diversity value.

Examples

# Most metrics just require an input vector of abundances.
test_abun <- c(0, NA, 1, 2, 10, 4)
FuncDiv_alpha_metrics[["richness"]](test_abun)

# Note that the input for computing Faith's PD is different.
# Get a randomly generated tree:
test_tree <- ape::rtree(n = 50)
test_present_tips <- c('t1', 't2', 't3')
FuncDiv_alpha_metrics[["faiths_pd"]](test_present_tips, test_tree)


FuncDiv documentation built on March 31, 2023, 8:12 p.m.