This allows the user to set a threshold for pupil size and remove anything classed as a blink as a result
detect_blinks_by_size(
data,
pupil,
threshold = 2.5,
extend_forward = 0,
extend_back = 0
)
dataset of class PupillometryR
column name for pupil data
velocity threshold for blink detection
number of observations to remove forward of blink
number of obervations to remove behind blink
returns dataframe with blinks removed including forward and back, and data in blink column.
Sdata <- make_pupillometryr_data(data = pupil_data,
subject = ID,
trial = Trial,
time = Time,
condition = Type)
Sdata2 <- detect_blinks_by_size(data = Sdata,
pupil = pupil_data,
threshold = 2.5,
extend_forward = 0,
extend_back = 0)
#> Error in mutate(., .min = mean(!!sym(pupil), na.rm = T) - (threshold * sd(!!sym(pupil), na.rm = T)), .max = mean(!!sym(pupil), na.rm = T) + (threshold * sd(!!sym(pupil), na.rm = T))): ℹ In argument: `.min = mean(pupil_data, na.rm = T) - (threshold *
#> sd(pupil_data, na.rm = T))`.
#> ℹ In group 1: `ID = "1"`, `Trial = Easy1`.
#> Caused by error in `is.data.frame()`:
#> ! 'list' object cannot be coerced to type 'double'