Description Usage Arguments Value Examples
View source: R/rolling_window.R
Calculate rolling window statistics for multiple combinations of statistics, variables, rolling window widths, and detrending options.
1 2 3 4 5 6 7 8 9 10 11 12 |
data |
data frame containing time series to calculate rolling window stats on |
var_cols |
character vector, variable names that are columns of *data* containing time series to calculate rolling window stats on |
id_cols |
character vector, two columns specifying "groups" to separate data into before calculating stats independently on, defaults are "Lake" and "Year" |
time_col |
character, column name that defines time step of data within the *id_cols* groupings |
statistics |
character vector, rolling window statistics to calculate, defaults to all available: c("Mean", "SD", "SD_sd", "Ar1", "Ar1_sd") |
vars_to_log |
character vector, optional variables names to log10 transform and create new columns before calculating rolling window stats |
log_offset |
positive numeric value, if any variables are being log transformed that contain negative values, all values will be shifted so that the minimum (before transformation) equals this value |
widths |
numeric vector, rolling window width(s) to be used, default is c(21) |
detrend |
TRUE or FALSE, should data within rolling windows be linearly detrended before calculating *statistics* |
min_prop |
numeric value between 0 and 1, proportion of data within a rolling window to calculate rolling window statistic, default 0.99 |
a data frame with the results for the specified stats, widths, variables, etc.
1 | rw_stats <- calc_rolling_stats(data = ts_data, var_cols = c("DO_Sat"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.