Use Generic Functions with Time Windows
tbr_misc(.tbl, x, tcolumn, unit = "years", n, func, ...)
a data frame with at least two variables; time column formatted as date, date/time and value column.
column containing the values the function is applied to.
formatted time column.
character, one of "years", "months", "weeks", "days", "hours", "minutes", "seconds"
numeric, describing the length of the time window.
specified function
optional additional arguments passed to function func
tibble
tbr_misc(Dissolved_Oxygen, x = Average_DO, tcolumn = Date, unit = "years", n = 5, func = mean)
#> # A tibble: 236 × 9
#> Station_ID Date Param_Code Param_Desc Average_DO Min_DO results
#> <int> <date> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 12515 2000-01-03 00300 OXYGEN, DISSOLVED… 6.19 6.19 6.19
#> 2 12515 2000-03-14 00300 OXYGEN, DISSOLVED… 6.7 6.7 6.73
#> 3 12517 2000-03-14 00300 OXYGEN, DISSOLVED… 7.3 7.3 6.73
#> 4 12515 2000-03-16 00300 OXYGEN, DISSOLVED… 6.41 6.41 6.65
#> 5 12515 2000-05-03 00300 OXYGEN, DISSOLVED… 4.42 4.42 6.20
#> 6 12517 2000-06-14 00300 OXYGEN, DISSOLVED… 5.74 5.74 6.13
#> 7 12515 2000-06-15 00300 OXYGEN, DISSOLVED… 4.86 4.86 5.95
#> 8 12515 2000-07-11 00300 OXYGEN, DISSOLVED… 4.48 4.48 5.76
#> 9 12515 2000-09-12 00300 OXYGEN, DISSOLVED… 5.64 5.64 5.75
#> 10 12517 2000-10-17 00300 OXYGEN, DISSOLVED… 7.96 7.96 5.97
#> # … with 226 more rows, and 2 more variables: min_date <date>, max_date <date>