make_onset_data {eyetrackingR}
Make onset-contingent data.
Description
Divide trials into which AOI participants started on. Calculate switches away from this AOI, using a rolling window to determine what length consitutes a switch. Augment original data with a column indicating whether each row is a switch-away sample.
Usage
make_onset_data(data, onset_time, fixation_window_length, target_aoi, distractor_aoi = NULL)
Arguments
data |
The original (verified) data |
onset_time |
When to check for participants' "starting" AOI? |
fixation_window_length |
Which AOI is currently being fixated is determined by taking a rolling average. This is the width of window for rolling average. |
target_aoi |
Which AOI is the target that should be switched *to* |
distractor_aoi |
Which AOI is the distractor that should be switched *from* (default = !target_aoi) |
Value
Original dataframe augmented with column indicating switch away from target AOI
Examples
data(word_recognition) data <- make_eyetrackingr_data(word_recognition, participant_column = "ParticipantName", trial_column = "Trial", time_column = "TimeFromTrialOnset", trackloss_column = "TrackLoss", aoi_columns = c('Animate','Inanimate'), treat_non_aoi_looks_as_missing = TRUE ) response_window <- subset_by_window(data, window_start_time = 15500, window_end_time = 21000, rezero = FALSE) inanimate_trials <- subset(response_window, grepl('(Spoon|Bottle)', Trial)) onsets <- make_onset_data(inanimate_trials, onset_time = 15500, fixation_window_length = 100, target_aoi='Inanimate')
[Package eyetrackingR version 0.1.3]