threshold_summary {SWMPrExtension} | R 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 |
param |
chr string of variable to plot (one only) |
summary_type |
Choose from |
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 |
pal |
Select a palette for boxplot fill colors. See |
plot_title |
logical, should the station name be included as the plot title? Defaults to |
plot |
logical, should a plot be returned? Defaults to |
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 assign_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)