Applies linear filtering to a univariate "timeSeries"
.
# S4 method for timeSeries
filter(x, filter, method = c("convolution", "recursive"), sides = 2,
circular = FALSE, init = NULL)
a "timeSeries"
object
an object from class "timeSeries"
.
coefficients of the filter.
"convolution"
or "recursive"
.
for convolution filters only. Onesided if sides = 1
, centred
around lag 0 if sides = 2
. Circular if circular =
TRUE.
for recursive filters only. Values before the start of the time series.
filter
is a generic function with default method
stats::filter
. The method for "timeSeries"
is a wrapper
for the latter.
See ?stats::filter
for details about the arguments.
base R function filter
## Creata a dummy signal 'timeSeries' -
data <- matrix(rnorm(100), ncol = 2)
s <- timeSeries(data, units=c("A", "B"))
head(s)
## Filter the series -
f <- filter(s, rep(1, 3))
head(f)
## Plot and compare the first series -
plot(cbind(s[, 1], f[, 1]), plot.type="s")
Run the code above in your browser using DataLab