shannon_index {SoilManageR} | R Documentation |
Calculate Shannon Index for diversity
Description
This function calculates the Index of Shannon (1948) for a tibble with different species.
The formula that is used is
SI = -\sum_{S=1}^i (p_i * ln(p_i))
where p_i
is the relative abundance of each species (S
).
Usage
shannon_index(var_tibble)
Arguments
var_tibble |
a tibble with two columns (name of species, count per species), the second column must be called "count" |
Value
double of the Shannon Index
References
Shannon CE (1948). “A Mathematical Theory of Communication.” Bell System Technical Journal, 27(3), 379-423.
Spellerberg IF, Fedor PJ (2003). “A tribute to Claude Shannon (1916–2001) and a plea for more rigorous use of species richness, species diversity and the ‘Shannon–Wiener’Index.” Global ecology and biogeography, 12(3), 177–179. doi:10.1046/j.1466-822X.2003.00015.x.
See Also
plant_diversity()
to calculate the shannon_index()
(and other diversity indices) for a management_df
Examples
#create tibble
tibble_example <- tibble::tibble(Plant = c("A","B","C","D","E"), count = c(10,5,8,20,10))
#calculate Shannon Index
shannon_index(tibble_example) # = 1.505...