filter_data: Run a filter on the data to smooth it out.

Description Usage Arguments Value Examples

View source: R/make_smoothed_data.R

Description

filter_data allows three different options for filtering, a butterworth lowpass filter, a hanning filter, or a median filter. You can also set the degree of this filter; we recommend a default of 11. This filters on one pupil, it can be re-run on a second pupil if needed. Lowpass makes use of the butterworth filter and filtfilt from package signal, median makes use of runmed.

Usage

1
2
3
4
5
6
filter_data(
  data,
  pupil,
  filter = c("median", "hanning", "lowpass"),
  degree = 11
)

Arguments

data

a PupillometryR dataframe

pupil

column name for pupil data

filter

option for filtering the data

degree

filter degree

Value

filtered pupil data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Sdata <- make_pupillometryr_data(data = pupil_data,
subject = ID,
trial = Trial,
time = Time,
condition = Type)
mean_data <- calculate_mean_pupil_size(data = Sdata,
pupil1 = RPupil, pupil2 = LPupil)
filtered_data <- filter_data(data = mean_data,
pupil = mean_pupil,
filter = 'hanning',
degree = 11)

samhforbes/PupillometryR documentation built on Sept. 14, 2021, 11:50 p.m.