calc_Metric: Calculate water quality metrics from diatom data

View source: R/calc_metric.R

calc_MetricR Documentation

Calculate water quality metrics from diatom data

Description

Calculate water quality metrics from diatom data

Usage

calc_Metric(
  x,
  metric = "TDI5LM",
  dictionary = darleq3::darleq3_taxa,
  taxon_names = NULL,
  verbose = TRUE,
  model_data = NULL
)

Arguments

x

data frame of diatom counts or relative abundance data

metric

diatom metric, one of "TDI3", "TDI4", "TDI5LM", "TDI5NGS", "LTDI1", "LTDI2", or "DAM". Defaults to "TDI5LM".

dictionary

diatom dictionary, a data frame with diatom taxon codes and indicator values for different metrics. Defaults to the built-in DARLEQ3 dictionary.

taxon_names

optional data frame containing taxon code in column 1 and taxon name in column 2. Used only to supply names of missing taxa in the job summary.

verbose

logical to indicate should function stop immediately on error (TRUE) or return a simpleError (FALSE). Defaults to TRUE.

model_data

list of 2 named elements: ma_coef=coefficients of major axis deshrinking regression, mono-mod= results of monotonic deshrinking GAM. Defaults to built-in values for TDI5NGS.

Details

calc_Metric takes as arguments a data frame of diatom counts or relative abundances, a metric code and a "dictionary" of diatom metric indicator values. The function will link the diatom taxon codes from the column names in the diatom data to those listed in the dictionary and calculate the relevant metric, along with some useful summary statistics. Diatom data should be coded with either NBS codes or 6-character DiatCode codes. See darleq3_taxa for the current DARLEQ3 dictionary.

Value

A object of class DIATOM_METRIC, a list with the following named elements:

Metric_Code

metric code

CodingID

taxon coding type - the column name containing taxon codes in the taxon dictionary

Metric

data frame with one column listing the value of the metric for each sample

Summary

data frame summaring the input data with the following columns:

  • Total_count: total diatom count for each sample

  • Percent_in_Metric, percentage of count included in metric calculations

  • N_Metric, Number of taxa included in metric calculations

  • N2_Metric, Hill's N2 effective number of taxa included in metric calculations

  • Max_Metric, maximum abundance of any taxon included in metric calculations

EcolGroup

data frame containing a list of the percentage of motile, organic tolerant, planktic and saline tolerant taxa in each sample

Job_Summary

list containing elements giving the total number of samples, number of samples with data, total number of taxa, number of taxa with occurrences, diatom metric and list of taxa that do not have a metric indicator value in the taxon dictionary

Author(s)

Steve Juggins Stephen.Juggins@ncl.ac.uk

References

Kelly, M., S. Juggins, R. Guthrie, S. Pritchard, J. Jamieson, B. Rippey, H. Hirst, and M. Yallop, Assessment of ecological status in UK rivers using diatoms. Freshwater Biology, 2008. 403-422.

Juggins, S., M. Kelly, T. Allott, M. Kelly-Quinn, and D. Monteith, A Water Framework Directive-compatible metric for assessing acidification in UK and Irish rivers using diatoms. Science of The Total Environment, 2016. 671-678.

Bennion, H., M.G. Kelly, S. Juggins, M.L. Yallop, A. Burgess, J. Jamieson, and J. Krokowski, Assessment of ecological status in UK lakes using benthic diatoms. Freshwater Science, 2014. 639-654.

Examples

fn <- system.file("extdata/DARLEQ2TestData.xlsx", package="darleq3")
d <- read_DARLEQ(fn, "Rivers TDI Test Data")
x <- calc_Metric(d$diatom_data, metric="TDI4")
head(x$Metric)


nsj3/darleq3 documentation built on Oct. 11, 2023, 4:37 a.m.