metric.values: Calculate metric values

View source: R/metric.values.R

metric.valuesR Documentation

Calculate metric values

Description

This function calculates metric values for bugs and fish. Inputs are a data frame with SampleID and taxa with phylogenetic and autecological information (see below for required fields by community).

Usage

metric.values(
  fun.DF,
  fun.Community,
  fun.MetricNames = NULL,
  boo.Adjust = FALSE
)

Arguments

fun.DF

Data frame of taxa (list required fields)

fun.Community

Community name for which to calculate metric values (bugs, fish, or algae)

fun.MetricNames

Optional vector of metric names to be returned. If none are supplied then all will be returned.

boo.Adjust

Optional boolean value on whether to perform adjustments of values prior to scoring. Default = FALSE but will always be TRUE for fish metrics.

Details

No manipulations of the taxa are performed by this routine. All benthic macroinvertebrate taxa should be identified to genus level. Any non-count taxa should be identified in the "NonUnique" field as "N". To run the MSW genus level the taxa should be combined before calculating the metrics.

Both

* Index.Name = Name of index to be used; MBSS_Fish_2005, MBSS_Bugs_2005, MSW_Bugs_1999 (genus index).

Benthic Macroinvertebrates

Bug metric values assumes the following fields (all upper case)

* SITE = MBSS sample identifier.

* TAXON = MBSS benthic macroinvertebrate name.

* N_TAXA = Number of taxon collected in sample.

* EXCLUDE = Non-unique taxa (i.e., parent taxon with one or more children taxa present in sample). Logical field. TRUE = do not include in taxa richness metrics.

* STRATA_R = Benthic macroinvertebrate region (COASTAL, EPIEDMONT, or HIGHLAND).

* Phylogenetic fields

+ (PHYLUM), CLASS, ORDER, FAMILY, GENUS, OTHER_TAXA, TRIBE, FFG, HABIT, FINALTOLVAL07

Valid values for FFG: col, fil, pre, scr, shr, pie

Valid values for HABIT: BU, CB, CN, SP, SW

MSW data should be first combined to family level and EXCLUDE recalculated.

Additional fields needed:

+ FAM_TV (need to include all the same fields, just leave blank).

For the EXCLUDE column there is additional QC to account for common non-standard entries.

* "Y" or "yes" will convert to TRUE.

* "N", "no", NA, or "" will convert to FALSE.

Fish

Fish metric values assumes the following fields (all upper case)

* SITE = MBSS sample identifier.

* FIBISTRATA = Fish region (COASTAL, EPIEDMONT, WARM, COLD).

* ACREAGE = Catchment area in acres.

* LEN_SAMP = Length of stream sampled; typically 75-meters.

* AVWID = Average stream width (meters) for sampled site.

* SPECIES = MBSS fish taxa name.

* TOTAL = Number of fish collected in sample.

* TYPE = Fish group identifier (ALL CAPS); SCULPIN, DARTER, MADTOM, etc.

* TROPHIC_MBSS = MBSS tropic status designations (ALL CAPS); OM, GE, IS, IV, etc.

* PTOLR = Pollution tolerance level (ALL CAPS); T, I, NO TYPE.

The R library dplyr is required for this function.

Value

data frame of SampleID and metric values

Examples

# Metrics, MBSS Index, Fish
myIndex <- "MBSS.2005.Fish"
# Thresholds
thresh <- metrics_scoring
# get metric names for myIndex
(myMetrics.Fish <- as.character(unique(thresh[thresh[,
"Index.Name"] == myIndex,"MetricName.Other"])))
# Taxa Data
myDF.Fish <- taxa_fish
myMetric.Values.Fish <- metric.values(myDF.Fish, "fish", myMetrics.Fish)
#View(myMetric.Values.Fish)

# Metrics, Index, Benthic Macroinvertebrates, genus
# (generate values then scores)
myIndex <- "MBSS.2005.Bugs"
# Thresholds
thresh <- metrics_scoring
# get metric names for myIndex
(myMetrics.Bugs.MBSS <- as.character(unique(thresh[thresh[,
"Index.Name"] == myIndex,"MetricName.Other"])))
# Taxa Data
myDF.Bugs.MBSS <- taxa_bugs_genus
myMetric.Values.Bugs.MBSS <- metric.values(myDF.Bugs.MBSS, "bugs",
myMetrics.Bugs.MBSS)
#View(myMetric.Values.Bugs.MBSS)

# Metrics, MSW Index, Benthic Macroinvertebrates, family
myIndex <- "MSW.1999.Bugs"
# Thresholds
thresh <- metrics_scoring
# get metric names for myIndex
(myMetrics.Bugs.MSW <- as.character(unique(thresh[thresh[,
"Index.Name"] == myIndex,"MetricName.Other"])))
# Taxa Data
myDF.Bugs.MSW <- taxa_bugs_family
myMetric.Values.Bugs.MSW <- metric.values(myDF.Bugs.MSW, "bugs",
myMetrics.Bugs.MSW)
#View(myMetric.Values.Bugs.MSW)

leppott/MBSStools documentation built on April 8, 2024, 9:57 p.m.