Skip to contents

Just a fancy wrapper for zoo::rollapply().

Usage

zoo_smooth_window(x = NULL, window = 3, f = mean, ...)

Arguments

x

(required, zoo object) Time series to smooth Default: NULL

window

(optional, integer) Smoothing window width, in number of cases. Default: 3

f

(optional, quoted or unquoted function name) Name of a standard or custom function to aggregate numeric vectors. Typical examples are mean, max,min, median, and quantile. Default: mean.

...

(optional, additional arguments) additional arguments to f.

Value

zoo object

Examples

x <- zoo_simulate()

x_smooth <- zoo_smooth_window(
  x = x,
  window = 5,
  f = mean
)

if(interactive()){
  zoo_plot(x)
  zoo_plot(x_smooth)
}