threshold_summary: Summary Plots for Threshold Identification

View source: R/threshold_summary.R

threshold_summaryR Documentation

Summary Plots for Threshold Identification

Description

Summary plots for threshold identification analysis

Usage

threshold_summary(swmpr_in, ...)

## S3 method for class 'swmpr'
threshold_summary(
  swmpr_in,
  param = NULL,
  summary_type = c("month", "season", "year"),
  parameter_threshold = NULL,
  threshold_type = NULL,
  time_threshold = NULL,
  converted = FALSE,
  pal = "Set3",
  plot_title = FALSE,
  plot = TRUE,
  label_y_axis = TRUE,
  ...
)

Arguments

swmpr_in

input swmpr object

...

additional arguments passed to other methods. See assign_season for more details.

param

chr string of variable to plot (one only)

summary_type

Choose from month, season, or year aggregation

parameter_threshold

vector of numerical thresholds to evaluate parameters against

threshold_type

vector of logical operators ('<', '>', '<=', '>=', '==', '!=')

time_threshold

The amount of time an event must last to be counted (in hours)

converted

logical, were the units converted from the original units used by CDMO? Defaults to FALSE. See y_labeler for details.

pal

Select a palette for boxplot fill colors. See scale_fill_brewer for more details.

plot_title

logical, should the station name be included as the plot title? Defaults to FALSE

plot

logical, should a plot be returned? Defaults to TRUE

label_y_axis

logical, include label for y-axis?

Details

This function provides a graphical or tabular summary of the results from threshold_identification. The user can summarize results on a monthly, seasonal, or annual basis by specifying summary_type = c('month', 'season', 'year'). If summary_type = 'season', then the user should also define season, season_names, and season_start, as required by |codeassign_season. The user can specify 'month' for nutrient parameters, but this is not recommended and will produce a warning.

Recommended thresholds for chlorophyll-a, dissolved inorganic nitrogen, dissolved inorganic phosphorus, and dissolved oxygen can be found in the National Coastal Condition Assessment 2010 (USEPA 2016)

Value

Returns a ggplot object (if plot = TRUE) or a dataframe (if plot = FALSE)

Author(s)

Julie Padilla

References

United States Environmental Protection Agency (USEPA). 2015. "National Coastal Condition Assessment 2010". EPA 841-R-15-006. https://cfpub.epa.gov/si/si_public_record_Report.cfm?Lab=OWOW&dirEntryId=327030

See Also

assign_season, ggplot, threshold_identification, scale_fill_brewer

Examples

## Water quality examples
data(apacpwq)
dat_wq <- qaqc(apacpwq, qaqc_keep = c(0, 3, 5))
dat_wq <- SWMPr::setstep(dat_wq)

x <-
  threshold_summary(dat_wq, param = 'do_mgl', parameter_threshold = 2
  , threshold_type = '<', time_threshold = 2, summary_type = 'month'
  , plot_title = TRUE)


y <-
  threshold_summary(dat_wq, param = 'do_mgl', parameter_threshold = 2,
  threshold_type = '<', time_threshold = 2, summary_type = 'season',
  season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12)),
  season_names = c('Winter', 'Spring', 'Summer', 'Fall'),
  season_start = 'Winter',
  plot_title = TRUE)

## Nutrient examples
dat_nut <- qaqc(apacpnut, qaqc_keep = c(0, 3, 5))

x <-
  threshold_summary(dat_nut, param = 'chla_n',
  parameter_threshold = 10,
  threshold_type = '>', summary_type = 'month',
  plot_title = TRUE)

y <-
  threshold_summary(dat_nut, param = 'chla_n', parameter_threshold = 10,
  threshold_type = '>', summary_type = 'season',
  season_grps = list(c(1,2,3), c(4,5,6), c(7,8,9), c(10, 11, 12)),
  season_names = c('Winter', 'Spring', 'Summer', 'Fall'),
  season_start = 'Winter', plot_title = TRUE)

 z <-
   threshold_summary(dat_nut, param = 'chla_n', parameter_threshold = 10,
   threshold_type = '>', summary_type = 'year',
   plot_title = TRUE, plot = TRUE)


SWMPrExtension documentation built on April 21, 2023, 1:14 a.m.