butterworth_filter: Butterworth Filter Helper

View source: R/butterworth_filter.R

butterworth_filterR Documentation

Butterworth Filter Helper

Description

A helper function which wraps around the [signal::butter()] and [signal::filfilt()] functions. It can be either a low or high pass filter for a given period. (The function can take the period argument because it does the conversion to frequency automatically. (frequency = 1/period).

Usage

butterworth_filter(df = NULL, order = 2,
f_low= 1/4, f_high = 1/72, plot = TRUE)

Arguments

df

required. A data.frame object where column 1 is a POSIXct object and the other columns are measurement values.

order

filter order. Default = 2.

f_low

Frequency for the low pass filter. Default = 1/4.

f_high

Frequency for the high pass filter. Default = 1/72.

plot

logical. If TRUE (default) plots the filtered data over the raw data. Red line is the low pass filter. Blue is the high pass filter. If FALSE, does not plot.

Examples


butter <- butterworth_filter(df = data, f_low = 1/4, f_high = 1/72)
print(butter)


edpclau/circadian-dynamics documentation built on Aug. 25, 2023, 12:18 p.m.