Description Usage Arguments Value See Also Examples
Produces a a rolling time-window based vector of means and confidence intervals.
1 |
.tbl |
a data frame with at least two variables; time column formatted as date, date/time and value column. |
x |
column containing the numeric values to calculate the mean. |
tcolumn |
formatted time column. |
unit |
character, one of "years", "months", "weeks", "days", "hours", "minutes", "seconds" |
n |
numeric, describing the length of the time window. |
... |
additional arguments passed to |
tibble with columns for the rolling mean and upper and lower confidence intervals.
1 2 3 4 5 6 7 | ## Return a tibble with new rolling mean column
tbr_mean(Dissolved_Oxygen, x = Average_DO, tcolumn = Date, unit = "years", n = 5)
## Not run:
## Return a tibble with rolling mean and 95% CI
tbr_mean(Dissolved_Oxygen, x = Average_DO, tcolumn = Date, unit = "years", n = 5, conf = .95)
## End(Not run)
|
# A tibble: 236 x 9
Station_ID Date Param_Code Param_Desc Average_DO Min_DO mean lwr_ci
<int> <date> <chr> <chr> <dbl> <dbl> <dbl> <lgl>
1 12515 2000-01-03 00300 OXYGEN, D… 6.19 6.19 NA NA
2 12515 2000-03-14 00300 OXYGEN, D… 6.7 6.7 6.73 NA
3 12517 2000-03-14 00300 OXYGEN, D… 7.3 7.3 6.73 NA
4 12515 2000-03-16 00300 OXYGEN, D… 6.41 6.41 6.65 NA
5 12515 2000-05-03 00300 OXYGEN, D… 4.42 4.42 6.20 NA
6 12517 2000-06-14 00300 OXYGEN, D… 5.74 5.74 6.13 NA
7 12515 2000-06-15 00300 OXYGEN, D… 4.86 4.86 5.95 NA
8 12515 2000-07-11 00300 OXYGEN, D… 4.48 4.48 5.76 NA
9 12515 2000-09-12 00300 OXYGEN, D… 5.64 5.64 5.75 NA
10 12517 2000-10-17 00300 OXYGEN, D… 7.96 7.96 5.97 NA
# … with 226 more rows, and 1 more variable: upr_ci <lgl>
# A tibble: 236 x 9
Station_ID Date Param_Code Param_Desc Average_DO Min_DO mean lwr_ci
<int> <date> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
1 12515 2000-01-03 00300 OXYGEN, D… 6.19 6.19 NA NA
2 12515 2000-03-14 00300 OXYGEN, D… 6.7 6.7 6.73 6.16
3 12517 2000-03-14 00300 OXYGEN, D… 7.3 7.3 6.73 6.16
4 12515 2000-03-16 00300 OXYGEN, D… 6.41 6.41 6.65 6.22
5 12515 2000-05-03 00300 OXYGEN, D… 4.42 4.42 6.20 5.45
6 12517 2000-06-14 00300 OXYGEN, D… 5.74 5.74 6.13 5.45
7 12515 2000-06-15 00300 OXYGEN, D… 4.86 4.86 5.95 5.25
8 12515 2000-07-11 00300 OXYGEN, D… 4.48 4.48 5.76 5.09
9 12515 2000-09-12 00300 OXYGEN, D… 5.64 5.64 5.75 5.14
10 12517 2000-10-17 00300 OXYGEN, D… 7.96 7.96 5.97 5.27
# … with 226 more rows, and 1 more variable: upr_ci <dbl>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.