Description Usage Arguments See Also Examples
View source: R/rolling_apply.R
Apply a function to the time series values in a sequence of user-defined, half-open time windows.
1 2 | rolling_apply_static(x, start_times, end_times, FUN, ..., align = "right",
interior = FALSE)
|
x |
a numeric time series object. |
start_times |
a |
end_times |
a |
FUN |
a function to be applied to the vector of observation values inside each half-open time interval |
... |
arguments passed to |
align |
either |
interior |
logical. If |
rolling_apply
for a version of this function that dynamically determines the time windows.
1 2 3 4 5 6 | start_times <- seq(as.POSIXct("2007-11-08"), as.POSIXct("2007-11-09 12:00:00"), by="12 hours")
end_times <- start_times + dhours(8)
rolling_apply_static(ex_uts(), start_times, end_times, FUN=mean, interior=TRUE)
rolling_apply_static(ex_uts(), start_times, end_times, FUN=mean)
rolling_apply_static(ex_uts(), start_times, end_times, FUN=mean, align="left")
rolling_apply_static(ex_uts(), start_times, end_times, FUN=mean, align="center")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.