movAv: Moving average filter

View source: R/generic_filters.R

movAvR Documentation

Moving average filter

Description

Moving average filter

Usage

movAv(x, winSec, incSec = NA, remove = FALSE, SR = frequency(x))

Arguments

x

A time-series or numeric vector

winSec

Size of the moving window, in seconds

incSec

Size of each window increment, in seconds. If NA a new window is calculated for every sample.

remove

If true, the function subtracts the rolling average from the the original signal, acting as a high-pass filter.

SR

The frequency of x, i.e. samples per second

Details

The burn-in sequence has length of winSec/2 while the burn-out sequence might be longer as not all combinations of winSec and incSec may perfectly cover any arbitrary x size. The burn-in and burn-out sequences are obtained through linear interpolation from their average value to the first or last values of the moving average series. The exact number of windows is given by ceiling((length(x)-win+1)/inc) where win and inc are respectively the window and increment sizes in samples.

Value

A time-series or numeric vector of the same length of x.


kleinbub/rIP documentation built on Dec. 21, 2024, 9:15 a.m.