historical_range {SWMPrExtension}R Documentation

Historical Monthly/Seasonal Range Timeseries

Description

Compare seasonal averages/minimums/maximums for a target year to historical seasonal averages/minimums/maximums

Usage

historical_range(swmpr_in, ...)

## S3 method for class 'swmpr'
historical_range(
  swmpr_in,
  param = NULL,
  hist_rng = NULL,
  target_yr = NULL,
  criteria = NULL,
  free_y = FALSE,
  log_trans = FALSE,
  converted = FALSE,
  criteria_lab = "WQ Threshold",
  plot_title = FALSE,
  plot = TRUE,
  ...
)

Arguments

swmpr_in

input swmpr object

...

additional arguments passed to other methods. See assign_season

param

chr string of variable to plot

hist_rng

numeric vector, if historic range is not specified then the min/max values of the data set will be used.

target_yr

numeric, the target year that should be compared against the historic range. If target year is not specified then dot will not be plotted

criteria

numeric, a numeric criteria that will be plotted as a horizontal line

free_y

logical, should the y-axis be free? Defaults to FALSE. If FALSE, defaults to zero, unless negative values are present. If TRUE, y-axis limits are selected by ggplot

log_trans

logical, should y-axis be log? Defaults to FALSE

converted

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

criteria_lab

chr, label for the threshold criteria defined in criteria. Defaults to "WQ Threshold"

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

Details

This function summarizes average daily values and average daily minimums/maximums across user-defined seasons for a target year (target_yr) and for a historical range (hist_rng). If hist_rng is not specified then the minimum and maximum years within the data set will be used. If target_yr is not specified then only the results for the hist_rng will be returned.

The user also has the option to add a threshold hold line using the criteria argument. Typically, this value is a water quality threshold, which is why criteria_lab defaults to 'WQ Threshold'. However, the user has the option to specify any other type of threshold they wish. when doing so, the value for criteria_lab should be changed accordingly.

Value

Returns a ggplot object

Author(s)

Julie Padilla, Kimberly Cressman

See Also

ggplot, assign_season, y_labeler

Examples




data(elksmwq)

dat <- qaqc(elksmwq, qaqc_keep = c('0', '3', '5'))
# with criteria
y <- historical_range(dat, param = 'do_mgl', target_yr = 2013, criteria = 2)

# w/o criteria
z <- historical_range(dat, param = 'do_mgl', target_yr = 2013)

# add a y label
zz <- z + labs(x = NULL, y = "Dissolved Oxygen (mg/L)")


[Package SWMPrExtension version 2.2.5.1 Index]