plot_qd: Plot rolling window statistics and qd alarms

Description Usage Arguments Value Examples

View source: R/quickest_detection.R

Description

Plot rolling window statistics and qd alarms

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plot_qd(
  rolling_window_stats,
  qd_alarms,
  var_col,
  stats = c("SD", "Ar1"),
  title = "R.W. width = 21",
  widths = c(21),
  plot_bloom_lines = FALSE,
  bloom_dates
)

Arguments

rolling_window_stats

data frame of rolling window statistics that is output from calc_rolling_stats

qd_alarms

data frame of quickest detection alarms, output from format_qd

var_col

character vector, variable names that are columns of *data* containing time series to calculate rolling window stats on

stats

statistics to plot, default and options are c("SD", "Ar1")

title

title to put on the plot

widths

numeric vector, rolling window width(s) to be used, default is c(21)

plot_bloom_lines

TRUE or FALSE (default), should lines for the bloom dates be plotted?

bloom_dates

if plot_bloom_lines = TRUE, this data frame is used to determine where

Value

a ggplot object

Examples

1
2
3
4
5
6
7
8
use_vars <- c("Manual_Chl", "BGA_HYLB", "DO_Sat", "pH")
rw_stats <- calc_rolling_stats(ts_data, var_cols = use_vars)
qd_stats <- run_qd(rw_stats, var_cols = use_vars)
qd_alarms <- format_qd(qd_stats, bloom_fert_df = bloom_fert_dates)
plot_qd(rw_stats, qd_alarms, use_vars[1],
  stats = c("SD", "Ar1"),
  plot_bloom_lines = TRUE, bloom_dates = bloom_fert_dates
)

cbuelo/tvsews documentation built on Jan. 21, 2022, 1:31 a.m.