View source: R/shannon_index.R
shannon_index | R Documentation |
This function calculates the Index of Shannon (1948) for a tibble with different species.
The formula that is used is
SI = -\sum_{i=1}^S (p_i * ln(p_i))
where p_i
is the relative abundance of each species (i
) of
the total number of species (S
).
shannon_index(var_tibble)
var_tibble |
a tibble with two columns (name of species, count per species), the second column must be called "count" |
double of the Shannon Index
shannon1948SoilManageR
\insertRefspellerberg2003tributeSoilManageR
plant_diversity()
to calculate the shannon_index()
(and other diversity indices) for a management_df
#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...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.