rollex: rollex

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Extended rolling mean, fill the extremeties with linear extrapolation. This way the output has same length as the original vector.

Usage

1
rollex(x, k = 5)

Arguments

x

a numerical vector

k

integer, width of the window for rolling mean

Value

A numerical vector of same length as x.

Examples

1
2
3
4
5
6
# Sinusoid + Gaussian white noise
x <- sin(seq(0,30,0.05))
x <- x + rnorm(length(x), mean = 0, sd = 0.2)
x_rollex <- rollex(x, k = 3)
plot(x)
lines(x_rollex, col = 'blue', lwd = 2)

majpark21/TSexploreR documentation built on Oct. 16, 2019, 2:46 p.m.