Gaussian smoothing
rollmean(x, size)
Numeric vector.
Radius of the smoothing (smaller than half of the length of x
).
If using size = 0
, it returns x
.
Numeric vector of the same length as x
, smoothed.
(x <- rnorm(10))
#> [1] 1.23342861 0.04786955 -0.19154277 1.39188974 -0.12644233 -1.51826009
#> [7] 0.74546643 1.12735913 1.99091601 0.03128344
rollmean(x, 3)
#> [1] 0.5744223 0.4814435 0.2743712 0.1857953 0.1198794 0.2879196 0.4449801
#> [8] 0.5667819 0.7593221 0.9691244