Learn R Programming

codyn (version 2.0.0)

community_structure: 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 evenness metric to return:

  • "Evar": The default metric, calculates Evar evenness from Smith and Wilson 1996

  • "SimpsonEvenness": Calculates Simpsons' evenness

  • "EQ": Calculates EQ evenness 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 evenness if evenness = "Evar"

  • EQ: A numeric column of EQ evenness if evenness = "EQ"

  • SimpsonEvenness: A numeric column of Simpsons evenness if evenness = "SimpsonEveness"

References

Smith, B. and Wilson, J. B. 1996. A consumer's guide to evenness indices. Oikos 76: 70-82.

Examples

Run this code
# NOT RUN {
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 metric

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 metric

#Example with no replicates
df <- subset(pplots, plot == 25)
community_structure(df, 
                    time.var="year", 
                    abundance.var = "relative_cover",
                    metric = "EQ") # for EQ evenness metric

#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 metric
# }

Run the code above in your browser using DataLab