View source: R/correct_peaks.R
boxcar_smooth | R Documentation |
Apply a moving average filter to a time series by convolution
boxcar_smooth(sig, window_size = 10)
sig |
The signal vector to be smoothed |
window_size |
The width of a boxcar used for an equally weighted window |
N.B. This function mirrors the results of numpy boxcar convolution with mode='same'. Thus, we zero pad the series, convolve, then take the middle segment to maintain the same length as the original series.
Note that this works as expected, but is remarkably slow on long time series when compared to zoo::rollmean or data.table::frollmean.
csig The smoothed time series
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.