This function calculates all of the indicators described in this package. 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.
extractAll(X, X_length, land, speciesinfo.table, species.table, years,
metric.bio = "ABUNDANCE", group.bio = "ALL", percentiles = c(0.25,
0.75), minTL.bio = 0, LSI.group, max.length = 85, LFI.group,
large.fish = 35, LenWt.table, guild.groups, condition.groups,
ratio.groups, maxlength.group, TL.grouping = 1, wind = 5,
negative = FALSE, resource.groups, minTL.FiB = 0, TE = 0.1,
base.start, base.end, landings.groups, FP.groups, minTL.FP = c(0,
3.25), raw = TRUE, std = TRUE, glob.env = TRUE,
export.path = NULL, export.id = NULL)
A dataframe of fishery independent data derived from research vessel
survey data or model output, with columns YEAR
, ID
,
SPECIES
, BIOMASS
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).
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 ABUNDANCE
is the corresponding 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.
A dataframe of commercial landings data with columns YEAR
,
ID
, SPECIES
and CATCH
. YEAR
indicates the year
the landing was recorded, ID
is an area code indicating where the
landing was recorded, SPECIES
is a numeric code indicating the
species landed, and CATCH
is the corresponding landed weight. If
land = NULL
, the landings-based indicators will not be calculated.
A table with columns SPECIES
and the
corresponding TL
, MAXLENGTH
, MAXAGE
, IVI
, and
TL_LAND
(trophic level, maximum recorded age, maximum recorded
length, intrinsic vulnerability index, and trophic level of the landings).
Entries in the SPECIES
column should be the unique values of species
codes in X
/X_length
(or a subset thereof). If there are
different species codes in X
and land
, the Fishing-in-Balance,
Intrinsic Vulnerability Index of Landings, Mean Trophic Level of the
Landings, and Marine Trophic Index should be calculated using their
respective single functions (see manual or vignette).
A table where the column names match the entries in
condition.groups
, FP.groups
, group.bio
,
guild.groups
, landings.group
, LFI.group
,
LSI.group
, maxlength.group
, ratio.groups
, and
resource.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.
A vector of years for which to calculate indicators.
A character string indicating which column in X
to
use to calculate the biodiversity indicators. Default is metric =
"ABUNDANCE"
.
A character string indicating which species to include in the
calculation of the Biodiversity indicators. If group = "ALL"
, all
species will be included; otherwise, group.bio
should match a column
name in species.table
. Default is group.bio = "ALL"
.
The percentiles used to determine R1 and R2 for calculating
Kempton's Q. Default is percentiles = c(0.25, 0.75)
.
Minimum trophic level for species included to calculate
Kempton's Q. Default is minTL.bio = 0
.
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.
The threshold for large species (cm). Default is
max.length = 85
(i.e., large species are those with MAXLENGTH
>= 85 cm).
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.
Threshold for large fish (cm). Default is large.fish =
35
(i.e., large fish are those with X_length$LENGTH
>= 35 cm).
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).
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.
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.
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.
A character string indicating the species group for
which to calculate the mean maximum length of fish in the community. Must be
set to "ALL"
or match a column name in species.table
. If
maxlength.group = NULL
, the mean maximum length will not be
calculated.
Size of the trophic level bin for which to aggregate
biomass when calculating Biomass per Trophic Level. For example, if
TL.grouping = 1
, trophic levels are binned from 1.00 - 1.99, 2.00 -
2.99, etc. If TL.grouping = 0.5, trophic levels are binned from 1.00 - 1.49,
1.50 - 1.99, 2.00 - 2.49, 2.50 - 2.99, etc. Default is TL.grouping =
1
so that biomass is aggregated over discrete trophic levels.
Window for the moving average used to calculate the Coefficient of
Variation of the Biomass. The first and last floor(wind/2)
values of
the indicator are assigned NA
to account for the moving average.
Default is wind = 5
years.
If negative = TRUE
, the Coefficient of Variation of the
Biomass and the Intrinsic Vulnerability Index of the Landings will be
multiplied by -1 so that their expected response is to decrease with
increasing fishing pressure. Default is negative = FALSE
.
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
resource.groups = NULL
, these indicators will not be calculated.
The minimum trophic level of species to include to calculate Fishing-in-Balance.
Trophic efficiency, used to calculate FiB. Default is TE =
0.1
, i.e., a trophic efficiency of 10%. If TE = NULL
, FiB will not
be calculated.
Year indicating the beginning of the baseline period for
calculating FiB. The average landings and average mean trophic level of the
landings over the baseline period are used as baseline values to calculate
FiB. land
must include data for the baseline period. If
base.start = NULL
, FiB will not be calculated.
Year indicating the end of the baseline period for calculating
FiB. The average landings and average mean trophic level of the landings
over the baseline period are used as baseline values to calculate FiB.
land
must include data for the baseline period. If base.end =
NULL
, FiB will not be calculated.
A vector indicating the species groups for which to
calculate the landings. Each entry must be a character string matching the
name of a column in species.table
. If landings.groups = NULL
,
no Landings indicators will be calculated.
A dataframe with two columns, which must be named
group.land
and group.X
. Each row holds the group names to
calculate the fishing pressure on a target group, with the numerator in
column group.land
and the denominator in column group.X
. Each
entry must be a character string matching the name of a column in
species.table
. If FP.groups = NULL
, no fishing pressure
indicators will be calculated.
A vector containing minimum trophic level to include when
calculating the mean trophic level of the landings. Default is minTL =
c(0, 3.25)
, which will return the mean trophic level of the landings and
the marine trophic index.
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
.
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
.
Logical value indicating whether to return output to global
environment. Default is glob.env = TRUE
.
File path indicating where to save a .csv file of
calculated indicators (named allIndicators_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
.
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 allIndicators_export.id.csv. Default is
export.id = NULL
.
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.
This function calculates the indicators for each attribute and pressure: Biodiversity, Structure and Functioning, Stability and Resistance, Resource Potential, and Fishing Pressure.
See the help file for the individual functions for information on how each indicator is calculated.
# NOT RUN {
# Compile data
data(X)
data(X_length)
data(land)
data(species.table)
data(species.info)
data(Length_Weight)
# Species groups of interest
trophicguild.groups <- c("LBENTHIVORE", "MBENTHIVORE", "PISCIVORE", "PLANKTIVORE",
"ZOOPISCIVORE")
condition.groups <- c("FINFISH", "PISCIVORE", "PLANKTIVORE", "ZOOPISCIVORE")
resource.groups <- c("ALL", "CLUPEIDS", "FINFISH", "FLATFISH", "FORAGE",
"GADOIDS", "GROUNDFISH", "PELAGIC", "SKATES")
ratio.groups <- data.frame(rbind(c("PELAGIC", "GROUNDFISH"), c("PREDATORS", "ALL")))
names(ratio.groups) <- c("group1", "group2")
landings.groups <- c("ALL", "CLUPEIDS.L", "FLATFISH.L", "GROUNDFISH.L")
FP.groups <- data.frame(rbind(c("ALL", "ALL"),
c("CLUPEIDS", "CLUPEIDS.L"),
c("FLATFISH", "FLATFISH.L"),
c("GROUNDFISH", "GROUNDFISH.L")))
names(FP.groups) <- c("group.X", "group.land")
# Calculate raw and standardized indicators
extractAll(X = X, X_length = X_length, land = land,
speciesinfo.table = species.info, species.table = species.table, years = c(2014:2019),
LSI.group = "ALL", LFI.group = "ALL", LenWt.table = Length_Weight,
guild.groups = trophicguild.groups, condition.groups = condition.groups,
ratio.groups = ratio.groups,
maxlength.group = "FINFISH",
resource.groups = resource.groups,
minTL.FiB = 0, base.start = 2014, base.end = 2015,
landings.groups = landings.groups, FP.groups = FP.groups,
raw = TRUE, std = TRUE, export.path = NULL)
# }
Run the code above in your browser using DataLab