Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shannons

Shannon's Diversity (Entropy) Index


Description

Calculates Shannon's Diversity Index and Shannon's Evenness Index

Usage

shannons(x, counts = TRUE, ens = FALSE, margin = "row")

Arguments

x

data.frame object containing counts or proportions

counts

Are data counts (TRUE) or relative proportions (FALSE)

ens

Calculate effective number of species (TRUE/FALSE)

margin

Calculate diversity for rows or columns. c("row", "col")

Value

data.frame with "H" (Shannon's diversity) and "evenness" (Shannon's evenness where H / max( sum(x) ) ) and ESN

Note

The expected for H is 0-3+ where a value of 2 has been suggested as medium-high diversity, for evenness is 0-1 with 0 signifying no evenness and 1, complete evenness.

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

References

Shannon, C. E. and W. Weaver (1948) A mathematical theory of communication. The Bell System Technical Journal, 27:379-423.

Simpson, E. H. (1949) Measurement of diversity. Nature 163:688

Roth, D. S., I. Perfecto, and B. Rathcke (1994) The effects of management systems on ground-foraging ant diversity in Costa Rica. Ecological Applications 4(3):423-436.

Examples

# Using Costa Rican ant diversity data from Roth et al. (1994)
data(ants)
  
# Calculate diversity for each covertype ("col") 
shannons(ants[,2:ncol(ants)], ens = TRUE, counts = FALSE, margin = "col")

# Calculate diversity for each species ("row") 
ant.div <- shannons(ants[,2:ncol(ants)], ens = TRUE, counts = FALSE, 
                    margin = "row")
  row.names(ant.div) <- ants[,1]
  ant.div

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.