tmdlCalcs: Prep data for TMDL analysis and plotting

View source: R/tmdlCalcs.R

tmdlCalcsR Documentation

Prep data for TMDL analysis and plotting

Usage

tmdlCalcs(
  idata,
  aggFun = "mean",
  cf,
  mos = 0,
  rec_ssn = c(121, 304),
  irg_ssn = c(135, 288),
  exportfromfunc = FALSE
)

Arguments

idata

A dataframe object containing parameter and flow data for sites of interest. Object has same column names as an EPA Water Quality Portal narrowresult object, with NumericCriterion and BeneficialUse columns added. Note that this function does not handle detection limits. These must be handled prior to calculating loading.

aggFun

String. A character object describing the function used to aggregate to daily/monthly/rec season/irrigation season values. Most typically will be one of the following: gmean, mean, max, min.

cf

Numeric. The correction factor to be applied to the loading calculation. Ensure this correction factor is in the correct units to accommodate flow and parameter units.

mos

Numeric. A proportion between 0 and 1 to be used as the margin of safety applied to the TMDL calculations. In other words, this proportion describes the

\item

rec_ssnNumeric. A two-object vector of year days signifying the start and end to the rec season.

\item

irg_ssnNumeric. A two-object vector of year days signifying the start and end to the irrigation season.

\item

exportfromfuncLogical. Indicates whether workbook should be exported from tmdlCalcs function, or skipped if using Shiny interface. Default is FALSE to accommodate Shiny use.

The output includes a new Excel workbook with the name of the original file plus today's date.xlsx, as well as the following dataframes, composed within a list: ecoli concentrations, flow data, ldc data, monthly means, rec/non rec means, and irg/non irg means. This function takes parameter concentration and flow data (if applicable) to calculate mean concentrations and loadings on a daily basis, with additional information provided for other aggregation exercises. Produces outputs that may be fed into plotting functions within the dwqInsights package.


edhinman/dwqInsights documentation built on Feb. 8, 2024, 3:52 a.m.