Zero-phase Butterworth lowpass filter via the suggested signal package's
butter() + filtfilt(). Useful for removing high-frequency noise from
biological or geophysical time series.
Usage
buttlp(x, fs, cutoff, order = 4L)
Arguments
- x
Numeric vector.
- fs
Sampling frequency (Hz).
- cutoff
Cutoff frequency (Hz).
- order
Filter order (default 4).
Value
List with filtered (numeric vector), fs, order, name.
Examples
# \donttest{
if (requireNamespace("signal", quietly = TRUE)) {
set.seed(1)
t <- seq(0, 1, length.out = 500)
x <- sin(2 * pi * 5 * t) + 0.5 * sin(2 * pi * 60 * t) # 5 Hz + 60 Hz
y <- buttlp(x, fs = 500, cutoff = 20)
length(y$filtered) # 500
}
#> [1] 500
# }