Learn R Programming

OTUtable (version 1.1.2)

shannon: Shannon's Biodiversity Index

Description

Calculates Shannon's Biodiversity Index on a single column of relative abundance data. This metric takes into account both richness and evenness.

Usage

shannon(sample)

Arguments

sample

A vector of relative abundance data, typically a single column in a matrix

Value

Returns a single number indicating the amount of biodiversity in the tested sample

Examples

Run this code
# NOT RUN {
data(otu_table)
richness <- apply(otu_table, 2, shannon)
# }

Run the code above in your browser using DataLab