eventmask: Add an event mask to sample data

View source: R/utilities.R

eventmaskR Documentation

Add an event mask to sample data

Description

eventmask is an internal function that takes sample data from an EDF file and adds binary variables indicating whether blinks, fixations, or saccades occurred for each trial

Usage

eventmask(EDFfile = NULL, samples = NULL, trials = NULL)

Arguments

EDFfile

path to an EDF file

samples

a data frame of sample data, resulting from edf.samples

trials

(optional). Output from edf.trials. Provide this instead of the EDFfile and samples

Details

eventmask is called internally from edf.samples, edf.trials, and edf.all to add 3 binary variables to sample data: fixation, saccade, and blink. Each variable is coded as 0 or 1 indicating the absence or presence of the fixation/saccade/blink for that sample. This is useful for quickly indexing sample data based on events (for instance, removing pupil data during blinks). Eyelink (almost) always records a saccade immediately before and after blinks, and those saccades are included as a part of the blink events.

Value

A data frame of the same sample data, with the variables fixation, saccade, and blink added to the end.

Author(s)

Jason Hubbard, hubbard3@uoregon.edu

Examples

## Not run: 

#This is called internally, but if you want to use it manually:
samples <- edf.samples('/path/to/file.edf')

samples_with_mask <- eventmask('/path/to/file.edf',samples)

#usually, you will use it in one of these ways:
trials <- edf.trials('/path/to/file.edf',samples=T,eventmask=T)
all <- edf.all('/path/to/file.edf',samples=T,eventmask=T)
samps <- edf.samples('/path/to/file.edf',eventmask=T)


## End(Not run)

jashubbard/edfR documentation built on Aug. 4, 2022, 5:18 p.m.