calcAlCrit: Calculate freshwater chronic and acute aluminum criteria

View source: R/calcAlCrit.R

calcAlCritR Documentation

Calculate freshwater chronic and acute aluminum criteria

Description

Calculates chronic and acute aluminum criteria according to the EPA 2018 update as documented here: https://www.epa.gov/wqc/aquatic-life-criteria-aluminum#2018. The function is a generalized wrapper for the criterion calculator provided within Aluminum Criteria Calculator R Code and Data V2.0 (Zip). Which allows the user to directly input hardness, pH, and DOC data as a data frame and specify column names as appropriate. The function code also includes a dput() version of the toxicity tables, which, although annoying to look at, allows the tables to follow the function without needing to read separate CSVs to the workspace. This is the final object, all, as on line 71 of the original calculator. This could be stored separately in package data if function is included in a package.

Usage

calcAlCrit(
  x,
  pH = "pH",
  hardness = "Hardness_mgL",
  DOC = "DOC_mgL",
  inc_ranks = T,
  tox_table = NULL
)

Arguments

x

Input dataset including pH, DOC, and hardness in a wide format. DOC and hardness must be in mg/L

pH

Column name (in quotes) for pH data.

hardness

Column name (in quotes) for hardness data.

DOC

Column name (in quotes) for DOC data.

inc_ranks

If TRUE (default), include genus toxicity ranking information in output.

tox_table

Optional. If desired, specify custom toxicity table for calculations. If not provided, default tables will be used.

Examples

# Build some test data
pH=sample(seq(6.3, 8.4, 0.1))
Hardness_mgL=sample(seq(25, 550, 25))
DOC_mgL=sample(seq(0.1, 2.2, 0.1))
sampID=paste0(rep('samp', 22), seq(1,22,1))
test_data=data.frame(sampID, pH, Hardness_mgL, DOC_mgL)
head(test_data)
# Apply function to test_data
criteria=calcAlCrit(test_data, 'pH', 'Hardness_mgL', 'DOC_mgL')

utah-dwq/udwqTools documentation built on July 17, 2024, 10:21 p.m.