en:div-ind_r
Section: Diversity analysis
Diversity indices
R functions
specnumber (library vegan)
- calculates species richness for individual samples, optionally number of species for different groups of samples. Applies on sample x species matrix of abundances, presences absences or other type of data (calculation of richness does not consider species abundances). Argumentgroup
allows to calculate group-based species richness (i.e. number of species occurring in samples classified into given group). Just a little more clever than simplerowSums (x > 0)
.diversity (library vegan)
- calculates Shannon and Simpson index. Applies on the sample x species matrix, where cells are species abundances. Argumentindex
is eithershannon
(calculates Shannon entropy),simpson
(calculates Gini-Simpson index, i.e. 1-Simpson, since Simpson index decreases with richness), andinvsimpson
(calculates reciprocal Simpson 1/D, which in fact is Simpson diversity - effective number of species calculated from Simpson's concentration index). Argumentbase
can modify the base of the logarithm which is used to calculate Shannon (default is the natural logarithm, some prefer to use base = 2). The function works also if data are not genuine counts of individuals (abundances), but other measures (dominance, cover); in that case, the interpretation is not “randomly chosen individual” (Shannon) or “two randomly chosen individuals” (Simpson), but e.g. “randomly chosen bit's of biomass”.d (library vegetarian)
- calculates Hill numbers for alpha, beta and gamma diversity. Applies on sample x species matrix of abundances (or biomass, cover etc.). Argumentq
modifies the coefficient q of the Hill numbers; default isq = 1
, which is Shannon diversity (effective number of species calculated from Shannon's entropy).q
can be any real number (also negative, although that makes no sense since this would give high weight to rare species). Allows estimating confidence intervals via bootstrapping. Forlevel = 'alpha
' it calculates diversity on the level of individual rows (samples), forlevel = 'gamma
' on the level of the whole dataset.level = 'beta
' calculates beta richness. Note: packagevegetarian
is currently not available on CRAN for the latest R versions; if you want to use it, you need to download it from the CRAN archive and install it manually in R Studio - go to Packages > Install > Install from package archive file (*zip, *tar.gz).H (library vegetarian)
- calculates the original diversity indices (called “standard diversity indices”), not converted into effective number of species (Hill numbers). The function can calculate species richness, Shannon entropy, Simpson concentration index, Ginni-Simpson index, HCDT entropy, and Renyi entropy, and all this on alpha, beta or gamma level.
en/div-ind_r.txt · Last modified: 2022/04/23 08:30 by David Zelený