summ_ldc: Summarize load duration curve

Description Usage Arguments Value Examples

View source: R/summ_ldc.R

Description

Calculates summary statistics for flow and pollutant concentrations for desired flow categories. Estimates "average" pollutant load per category based on average concentration times the median flow.

Usage

1
summ_ldc(.tbl, Q, C, Exceedance, groups, method = "geomean")

Arguments

.tbl

data frame, prefferably the output from calc_ldc().

Q

variable name in .tbl for discharge or flow. This must have unit set, typically "ft^3/s".

C

variable name in .tbl for associated pollutant concentration at a given flow value. This must have a unit set, typically "mg/L" or "cfu/100mL".

Exceedance

variable name in .tbl with flow/load exceedance probabilities.

groups

variable name in .tbl with categorized flow names.

method

string that describes the summary statistic used for the pollutant concentration. Must be one of c('geomean', 'mean', 'median').

Value

object of class tibble. Includes Flow Category grouping variable, median flow and exceedance values, geometric mean/mean/median pollutant concentration, and estimated average load based on median flow times the average pollutant concentration per flow category.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Basic example using built in Tres Palacios data
library(dplyr)
library(units)
# Format data
install_unit("cfu")
df <- as_tibble(tres_palacios) %>%
        ## filter data so this run quicker
        filter(!is.na(Indicator_Bacteria)) %>%
        ## flow must have units, here is is in cfs
        mutate(Flow = set_units(Flow, "ft^3/s")) %>%
        ## pollutant concentration must have units
        mutate(Indicator_Bacteria = set_units(Indicator_Bacteria, "cfu/100mL"))
# Calculate LDC

## specify the allowable concentration
allowable_concentration <- 126
## set the units
units(allowable_concentration) <- "cfu/100mL"
df_ldc <- calc_ldc(df,
                   Q = Flow,
                   C = Indicator_Bacteria,
                   allowable_concentration = allowable_concentration)

# Summarize LDC
df_sum <- summ_ldc(df_ldc,
                   Q = Flow,
                   C = Indicator_Bacteria,
                   Exceedance = P_Exceedance,
                   groups = Flow_Category,
                   method = "geomean")
df_sum

## cleanup
remove_unit("cfu")

TxWRI/ldc documentation built on Feb. 13, 2022, 9:22 a.m.