allBiodiversity: Calculates all Biodiversity indicators

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/allBiodiversity.R

Description

This function calculates all (or a subset) of the Biodiversity indicators for j areas and i years. The user can choose whether the function returns the indicator dataframe to the global environment, exports the dataframe to a csv file, or both. The user can also choose whether the function returns the raw indicator values, the standardized (z-score) values, or both.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
allBiodiversity(
  X,
  metric = "ABUNDANCE",
  groups = "ALL",
  species.table = NULL,
  TL.table,
  percentiles = c(0.25, 0.75),
  minTL = 0,
  years,
  raw = TRUE,
  std = TRUE,
  glob.env = TRUE,
  export.path = NULL,
  export.id = NULL
)

Arguments

X

A dataframe of fishery independent data derived from research vessel survey data or model output, with columns YEAR, ID, SPECIES, and ABUNDANCE. YEAR indicates the year the observation was recorded, ID is an area code indicating where the observation was recorded, SPECIES is a numeric code indicating the species sampled, and ABUNDANCE is the corresponding abundance (stratified and corrected for catchability as required).

metric

A character string indicating which column in X to use to calculate the indicators. Default is metric = "ABUNDANCE".

groups

A vector indicating the species group(s) for which to calculate the indicators. If groups = "ALL", all species will be included; otherwise, each entry must be a character string matching the name of a column in species.table. Default is groups = "ALL".

species.table

A table where the column names match the entries in groups. Column entries are species codes indicating the species from X included in each group. species.table may also include columns for other species groups; these will be ignored. If groups = "ALL", this table is not required. Default is species.table = NULL.

TL.table

A dataframe with columns SPECIES and the corresponding TL (trophic level). Entries in the SPECIES column should be the unique values of species codes in X (or a subset thereof). Other columns in TL.table are ignored. If TL.table = NULL, Kempton's Q will not be calculated.

percentiles

The percentiles used to determine R1 and R2 for calculating Kempton's Q. Default is percentiles = c(0.25, 0.75).

minTL

Minimum trophic level for species included to calculate Kempton's Q. Default is minTL = 0.

years

A vector of years for which to calculate indicators.

raw

A logical value. If raw = TRUE, the raw indicator values are returned by the function. If raw = FALSE, the raw indicator values are not returned. Default is raw = TRUE. Either raw or std must be TRUE.

std

A logical value. If std = TRUE, the standardized indicator values for each area ID are returned by the function. Indicators are standardized using z-scores, i.e., by subtracting the mean and dividing by the standard deviation (ignoring NA values). If std = FALSE, the standardized indicator values are not returned. Default is std = TRUE. Either raw or std must be TRUE.

glob.env

Logical value indicating whether to return output to global environment. Default is glob.env = TRUE.

export.path

File path indicating where to save a .csv file of calculated indicators (named biodiversity_export.id.csv; see below). If export.file = NULL, the indicator dataframe will not be exported as a .csv file. Default is export.path = NULL.

export.id

Character string to modify the name of the .csv file (if export.path is specified), for example an area name or date of analysis. The exported .csv file is named biodiversity_export.id.csv. Default is export.id = NULL.

Details

This function calculates the Biodiversity indicators: Species Richness, Shannon's Index of Diversity, Margalef's Species Richness, Pielou's Species Evenness, Hill's N1, Hill's N2, Heip's Evenness Index, and Kempton's Q. If trophic level data are not available to calculate Kempton's Q, the remaining Biodiversity indicators will be returned. See the help file for the individual functions for information on how each indicator is calculated.

Notes on indicator calculations: In the individual functions, the user generally has control over which metric (e.g., "BIOMASS" or "ABUNDANCE") and group (e.g., "ALL" or "GROUNDFISH") are used to calculate the indicator. Here, the same metric and group are used to calculate each indicator. Defaults are metric = "ABUNDANCE" and group = "ALL".

Value

Returns a dataframe with columns ID, YEAR, and indicators corresponding to the arguments supplied to the function. Standardized indicators are noted with _s in the name.

Author(s)

Danielle Dempsey, Adam Cook Adam.Cook@dfo-mpo.gc.ca, Catalina Gomez, Alida Bundy

See Also

Other biodiversity indicators: heips(), hillN1(), hillN2(), kemptonQ(), margalef(), pielouEvenness(), shannon(), speciesRichness()

Examples

1
2
3
4
5
data(X)

# Calculate raw and standardized indicators
allBiodiversity(X = X, metric = "ABUNDANCE", groups = "ALL", TL.table = species.info,
   percentiles = c(.25, 0.75), minTL = 0, years = c(2014:2019), raw = TRUE, std = TRUE)

dempseydanielle/marindicators documentation built on May 12, 2020, 8:12 p.m.