rolling_slope: Calculate first and second derivative of chlorine trend

View source: R/rolling-slope.R

rolling_slopeR Documentation

Calculate first and second derivative of chlorine trend

Description

rolling_slope calculates the first and second derivative of a provided time series trend along with the moving average of these values

Usage

rolling_slope(
  data,
  date_col,
  value_col,
  group_col = NULL,
  model = c("ss", "gam", "loess"),
  return_models = FALSE
)

Arguments

data

a dataframe or tbl that contains at the minimum a date column and a chlorine residual column

date_col

the unqouted name of the date column

value_col

the unquoted name of the chlorine residual column

group_col

vector of unqouted names of all grouping columns, if grouping is needed - e.g. if the dataset contains multiple sites and/or parameters.

model

the model type to use to estimate total chlorine trend. One of "ss" (smooth spline), "gam" (generalized additive model), or "loess" (Local Polynomial Regression)


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