Skip to contents

Apply a Savitzky-Golay filter to a view

Usage

apply_filter_sgolay(
  view,
  data_points,
  n,
  p,
  folder_out = "Filtered",
  save_output = FALSE
)

Arguments

view

View object.

data_points

body parts e.g. 'Nose'.

n

window size.

p

poly order.

folder_out

output folder relative to recording home (default is 'Filtered').

save_output

save the output?

Value

a FilteredView object.

Examples

r <- get_sample_recording()
rv <- get_raw_view(r, "Central", "", "Sitar")
pv <- get_processed_view(rv)

set.seed(1)
fv1 <- apply_filter_sgolay(pv, c("Nose", "RWrist", "LWrist"), n = 19, p = 4)
fv2 <- apply_filter_sgolay(pv, c("Nose", "RWrist", "LWrist"), n = 41, p = 3)

set.seed(1) # to reproduce with S3 filter object
fv3 <- apply_filter(pv, c("Nose", "RWrist", "LWrist"), signal::sgolay(4, 19))