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: - `"Evar"`: The default measure, calculates evenness as Evar from Smith and Wilson 1996. - `"SimpsonEvenness"`: Calculates Simpson's evenness. - `"EQ"`: Calculates evenness as EQ from Smith and Wilson 1996.
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 `metric = "Evar"`. - **EQ**: A numeric column of EQ if `metric = "EQ"`. - **SimpsonEvenness**: A numeric column of Simpson's evenness if `metric = "SimpsonEvenness"`.#'
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
#> year plot richness Evar
#> 1 2002 6 23 0.2816103
#> 2 2003 6 18 0.2039001
#> 3 2004 6 22 0.3091447
#> 4 2005 6 15 0.2917799
#> 5 2002 25 18 0.2598594
#> 6 2003 25 15 0.2065058
#> 7 2004 25 20 0.2441690
#> 8 2005 25 16 0.1912342
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
#> year plot richness SimpsonEvenness
#> 1 2002 6 23 0.1761222
#> 2 2003 6 18 0.2784896
#> 3 2004 6 22 0.1327396
#> 4 2005 6 15 0.2499747
#> 5 2002 25 18 0.2262414
#> 6 2003 25 15 0.2646880
#> 7 2004 25 20 0.1463984
#> 8 2005 25 16 0.3654740
#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
#> year richness EQ
#> 1 2002 18 0.1189180
#> 2 2003 15 0.1057368
#> 3 2004 20 0.1243605
#> 4 2005 16 0.1033874
#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
#> richness Evar
#> 1 18 0.2598594