make_switch_data: Summarize data into time-to-switch from initial AOI.

View source: R/onset_contingent_data.R

make_switch_dataR Documentation

Summarize data into time-to-switch from initial AOI.

Description

Take trials split by initial-AOI, and determine how quickly participants switch away from that AOI

Usage

make_switch_data(data, predictor_columns, summarize_by)

## S3 method for class 'onset_data'
make_switch_data(data, predictor_columns = NULL, summarize_by = NULL)

Arguments

data

The output of make_onset_data

predictor_columns

Variables/covariates of interest when analyzing time-to-switch

summarize_by

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)

Value

A dataframe indicating initial AOI and time-to-switch from that AOI for each trial/subject/item/etc.

Methods (by class)

  • make_switch_data(onset_data):

Examples

## Not run: 
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")

## End(Not run)
                          

eyetrackingR documentation built on Sept. 15, 2023, 5:08 p.m.