community_structure {codyn} | R Documentation |
Community Structure
Description
Calculates species richness and evenness of a community. Evenness may be calculated as Simpson's (1/D/S), EQ, or Evar, but only one metric of evenness can be calculated at a time and must be specified.
Usage
community_structure(
df,
time.var = NULL,
abundance.var,
replicate.var = NULL,
metric = c("Evar", "SimpsonEvenness", "EQ")
)
Arguments
df |
A data frame containing species and abundance columns and optional columns of time and/or replicate. |
time.var |
The name of the optional time column |
abundance.var |
The name of the abundance column |
replicate.var |
The name of the optional replicate column. If specified, replicate must be unique within the dataset and cannot be nested within treatments or blocks. |
metric |
The measure of evenness to return:
|
Value
The community_structure function returns a data frame with the following attributes:
time.var: A column that has the same name and type as the time.var column, if time.var is specified.
replicate.var: A column that has same name and type as the replicate.var column, if specified.
richness: A numeric column of species richness
Evar: A numeric column of Evar if evenness = "Evar"
EQ: A numeric column of EQ if evenness = "EQ"
SimpsonEvenness: A numeric column of Simpson's evenness if evenness = "SimpsonEveness"
References
Smith, B. and Wilson, J. B. 1996. A consumer's guide to evenness indices. Oikos 76: 70-82.
Examples
data(pplots)
#Example with both time and replicates
df <- subset(pplots, plot == 25 | plot == 6)
community_structure(df,
time.var="year",
replicate.var = "plot",
abundance.var = "relative_cover") # for Evar evenness measure
df <- subset(pplots, plot == 25 | plot == 6)
community_structure(df,
time.var="year",
replicate.var = "plot",
abundance.var = "relative_cover",
metric = "SimpsonEvenness") # for Simpson's evenness measure
#Example with no replicates
df <- subset(pplots, plot == 25)
community_structure(df,
time.var="year",
abundance.var = "relative_cover",
metric = "EQ") # for EQ evenness measure
#Example with only a single time point and no replicates
df <- subset(pplots, plot == 25 & year == 2002)
community_structure(df,
abundance.var = "relative_cover") # for Evar evenness measure