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.
make_onset_data(
data,
onset_time,
fixation_window_length = NULL,
target_aoi,
distractor_aoi = NULL
)
The original (verified) data
When to check for participants' "starting" AOI?
Which AOI is currently being fixated is determined by taking a rolling average of this length (ms). This is the width of window for rolling average.
Which AOI is the target that should be switched *to*
Which AOI is the distractor that should be switched *from* (default = !target_aoi)
Original dataframe augmented with column indicating switch away from target AOI
if (FALSE) {
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, target_aoi='Inanimate')
}