allStructure: Calculates all Structure and Functioning indicators

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

View source: R/allStructure.R

Description

This function calculates all (or a subset) of the Structure and Functioning 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
allStructure(X, X_length, LSI.group, LFI.group, max.length = 85,
  large.fish = 35, guild.groups, condition.groups, ratio.groups,
  species.table, speciesinfo.table, LenWt.table, 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 BIOMASS. 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 BIOMASS is the corresponding biomass (stratified and corrected for catchability as required).

X_length

A dataframe of fishery independent data derived from research vessel survey data or model output, with columns YEAR, ID, SPECIES, LENGTH, BIOMASS and ABUNDANCE. YEAR indicates the year the observation was recorded, ID is an area code indicating where the observation was recorded, and SPECIES is a numeric code indicating the species sampled. LENGTH is the length class (cm) and BIOMASS/ABUNDANCE is the corresponding biomass/abundance at length (stratified and corrected for catchability as required). Species for which there are no length data should be assigned LENGTH = -99. These observations are removed by the function.

LSI.group

A character string indicating the species group for which to calculate the Large Species Indicator. Must be set to "ALL" or match a column name in species.table. If LSI.group = NULL, the Large Species Indicator will not be calculated.

LFI.group

A character string indicating the species group for which to calculate the Large Fish Indicator. Must be set to "ALL" or match a column name in species.table. If LFI.group = NULL, the Large Fish Indicator will not be calculated.

max.length

The threshold for large species (cm). Default is max.length = 85 (i.e., large species are those with MAXLENGTH >= 85 cm).

large.fish

Threshold for large fish (cm). Default is large.fish = 35 (i.e., large fish are those with X_length$LENGTH >= 35 cm).

guild.groups

A vector indicating the species groups for which to calculate the resource potential. Each entry must be a character string matching the name of a column in species.table. If guild.groups = NULL, these indicators will not be calculated.

condition.groups

A vector indicating the species groups for which to calculate Fulton's community condition factor. Each entry must be a character string matching the name of a column in species.table. If condition.groups = NULL, the community condition indicators will not be calculated.

ratio.groups

A dataframe with two columns, which must be named group1 and group2. Each row holds the group names for one biomass ratio, with the numerator in column group1 and the denominator in column group2. Each entry must be a character string matching the name of a column in species.table or "ALL". If ratio.groups = NULL, biomass ratio indicators will not be calculated.

species.table

A table where the column names match the entries in guild.groups, ratio.groups, and/or condition.groups. Column entries are the species codes indicating the species from X (or X_length) included in each group. species.table may also include columns for other species groups; these will be ignored.

speciesinfo.table

A table with columns SPECIES and the corresponding TL and MAXLENGTH (trophic level and maximum recorded length). Entries in the SPECIES column should be the unique values of species codes in X/X_length (or a subset thereof). Other columns will be ignored.

LenWt.table

A table of annual length at weight data with 5 columns. YEAR, ID, and SPECIES are as described in X_length. LENGTH is fish length at the corresponding WEIGHT (fish weight).

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 structure_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 structure_export.id.csv. Default is export.id = NULL.

Details

This function calculates the Structure and Functioning indicators: Biomass, Biomass Ratio(s), Large Species Indicator, Trophic Level of the Community, Large Fish Indicator, Mean Length (weighted by biomass and abundance), and Community Condition. If data are not available to calculate one or more of these indicators, a subset 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 is used to calculate the indicator (e.g., BIOMASS or ABUNDANCE). Here, BIOMASS is used to calculate Biomass, Biomass Ratio(s), Large Species Indicator, Large Fish Indicator, Trophic Level of the Community, and Mean Length weighted by biomass. ABUNDANCE is used to calculate Mean Length weighted by abundance and Community Condition. See individual functions for more flexibility.

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 Danielle.Dempsey@dfo-mpo.gc.ca, Adam Cook, Catalina Gomez, Alida Bundy

References

Bundy A, Gomez C, Cook AM. 2017. Guidance framework for the selection and evaluation of ecological indicators. Can. Tech. Rep. Fish. Aquat. Sci. 3232: xii + 212 p.

See Also

Other ecosystem structure and function indicators: biomassRatio, communityCondition, largeFishIndicator, largeSpeciesIndicator, meanTLCommunity

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Compile data
data(X)
data(X_length)
data(species.table)
data(species.info)
data(Length_Weight)

# Species groups of interest
ratio.groups <- data.frame(rbind(c("PELAGIC", "GROUNDFISH"), c("PREDATORS", "ALL")))
names(ratio.groups) <- c("group1", "group2")
trophicguild.groups <- c("LBENTHIVORE", "MBENTHIVORE", "PISCIVORE", "PLANKTIVORE",
   "ZOOPISCIVORE")
condition.groups <- c("FINFISH", "LBENTHIVORE", "MBENTHIVORE", "PISCIVORE",
    "PLANKTIVORE", "ZOOPISCIVORE")

# Calculate raw indicators
allStructure(X = X, X_length = X_length,
   LSI.group = "ALL", LFI.group = "ALL",
    max.length = 85, large.fish = 35,
   guild.groups = trophicguild.groups, condition.groups = condition.groups,
   ratio.groups = ratio.groups,
   species.table = species.table, speciesinfo.table = species.info,
   LenWt.table = Length_Weight,
   years = c(2014:2019), raw = TRUE, std = FALSE)

marindicators documentation built on Nov. 12, 2019, 5:07 p.m.