compute_alpha_div {FuncDiv}R Documentation

Convenience function for running default alpha diversity metrics on a single vector input

Description

This is a simple wrapper for FuncDiv_alpha_metrics, and you can see more details with ?FuncDiv_alpha_metrics.

Usage

compute_alpha_div(x, metric, ...)

Arguments

x

input vector. Either class numeric (representing abundance of categories [e.g., microbes]) or character (indicating which taxa are present, which is required for faiths_pd).

metric

alpha diversity metric to compute. Must be one of names(FuncDiv_alpha_metrics).

...

included so that functions with single arguments will not throw errors if tree is included (and ignored). This should be a phylo object to use in case of faiths_pd.

Details

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.

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)
compute_alpha_div(x = test_abun, metric = "richness")

# 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')
compute_alpha_div(x = test_present_tips, metric = "faiths_pd", tree = test_tree)


[Package FuncDiv version 1.0.0 Index]