R/onset_contingent_data.R
make_switch_data.Rd
Take trials split by initial-AOI, and determine how quickly participants switch away from that AOI
make_switch_data(data, predictor_columns, summarize_by)
# S3 method for onset_data
make_switch_data(data, predictor_columns = NULL, summarize_by = NULL)
The output of make_onset_data
Variables/covariates of interest when analyzing time-to-switch
Should the data be summarized along, e.g., participants, items, etc.? If so, give column name(s) here. If left blank, will leave trials distinct. The former is needed for more traditional analyses (t.tests, ANOVAs), while the latter is preferable for mixed-effects models (lmer)
A dataframe indicating initial AOI and time-to-switch from that AOI for each trial/subject/item/etc.
make_switch_data(onset_data)
:
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,
fixation_window_length = 100, target_aoi='Inanimate')
df_switch <- make_switch_data(onsets, predictor_columns = "MCDI_Total",
summarize_by = "ParticipantName")
plot(df_switch, "MCDI_Total")
}