Skip to contents

Direct short-name export of the Savitzky-Golay smoother (matches the Python morie.signal.sgolay name). For the long-form, see morie_sgolay_smooth(), which this function delegates to.

Usage

sgolay(x, window = 11L, polyorder = 3L)

Arguments

x

Numeric vector.

window

Window length (odd, default 11).

polyorder

Polynomial order (default 3).

Value

List with filtered, name, fs, n_samples, extra (window, polyorder).

Details

Reference: Savitzky, A. & Golay, M.J.E. (1964) "Smoothing and differentiation of data by simplified least-squares procedures", Anal. Chem. 36(8):1627–1639.

Examples

# \donttest{
if (requireNamespace("signal", quietly = TRUE)) {
  set.seed(1)
  x <- sin(seq(0, 2 * pi, length.out = 200)) + 0.1 * rnorm(200)
  res <- sgolay(x)
  length(res$filtered)
}
#> [1] 200
# }