Skip to contents

This function calculates several alpha diversity indices (Shannon, Simpson, Observed Species, Chao1, ACE, and Pielou) using the vegan package. The function takes an OTU table (x) as input and returns a list containing the requested alpha diversity indices.

Usage

mStat_calculate_alpha_diversity(x, alpha.name)

Arguments

x

OTU table with taxa in rows and samples in columns.

alpha.name

character vector containing the names of alpha diversity indices to calculate. Possible values are: "shannon", "simpson", "observed_species", "chao1", "ace", and "pielou".

Value

A list containing the requested alpha diversity indices.

Examples

if (FALSE) { # \dontrun{
# Create example OTU table
otu.tab <- matrix(data = rpois(100, 5), nrow = 10, ncol = 10)
rownames(otu.tab) <- paste0("Taxon_", 1:10)
colnames(otu.tab) <- paste0("Sample_", 1:10)

# Calculate alpha diversity indices
alpha.obj <- mStat_calculate_alpha_diversity(x = otu.tab, alpha.name =
c("shannon", "simpson", "observed_species", "chao1", "ace", "pielou"))
} # }