plot_fl: Plot falling limb functions

View source: R/plot-fl.R

plot_flR Documentation

Plot falling limb functions

Description

plot_fl provides methods to plot the falling limb of a chlorine residual time series plot. This function will be useful for trying to visualize how selected parameters such as rolling_window effect the grouping of data points

Usage

plot_fl(
  data,
  date_col,
  value_col,
  ...,
  rolling_window = 8,
  max_chlorine = 1.5,
  smooth_deriv = FALSE,
  deriv_window = NULL,
  date_breaks = "6 months",
  date_labels = "%b %d, %Y",
  ylab = "",
  ylim = NULL,
  plot_title = "",
  plot_subtitle = "",
  include_first = FALSE,
  first_ylim = NULL,
  theme = NULL,
  nitrite_col,
  nitrite_ylab = "Nitrite",
  nitrite_ylim = NULL,
  ncol = NULL,
  nrow = NULL
)

Arguments

data

a data frame containing chlorine residual results

date_col

unqouted column name of date time column in data

value_col

unquoted column name of chlorine column in data

...

unqouted column name(s) of grouping variable(s)

rolling_window

how many weeks of data should be included in the rolling average window function when calculating the first and second derivative of the chlorine time series. Defaults to 8.

max_chlorine

maximum chlorine residual value that can be included in falling limb. For example, if you are not concerned with sites when chlorine is greater than 1.5 (default) than no value greater than this threshold will be classified as either "Falling Limb" or "Nitrification Ongoing"

date_breaks

a character string to be passed to either ggplot2::scale_x_date or ggplot2::scale_x_datetime to specify the spacing of date breaks (e.g. "1 month" or "3 weeks")

date_labels

a character string specifying the desired output format of dates on x axis. See strptime for options

ylab

a character string specifying the y axis label for the main plot

ylim

a vector of length two specifying the limits of the y axis for the chlorine plot. If NULL (default) default ggplot2 limits will be used

plot_title

a character string specifying the title of the plot

plot_subtitle

a chacter string specifying the subtitle of the plot

include_first

logical; should a plot of the first derivative and its moving average be included along with the main trend?

first_ylim

a vector of length two specifying the limits of the y axis for the first derivative of chlorine plot. If NULL (default) default ggplot2 limits will be used

theme

a ggplot2::theme object that can be passed to all plots

nitrite_col

column name (optional) of column containing nitrite data that corresponds with the chlorine data. This will be plotted alongside the chlorine data via the patchwork package

nitrite_ylab

character string that specifies the y label for the nitrite graph. Only used if nitrite_col is specified

nitrite_ylim

a vector of length two specifying the limits of the y axis for the nitrite plot. If NULL (default) default ggplot2 limits will be used

ncol, nrow

If grouping variable is specified, these arguments set the number of columns and rows, respectively of the resultant facetted plot


tbradley1013/dwqr documentation built on Feb. 11, 2024, 10:03 a.m.