View source: R/onset_contingent_data.R
make_onset_data | R Documentation |
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
)
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 of this length (ms). 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) |
Original dataframe augmented with column indicating switch away from target AOI
## 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, target_aoi='Inanimate')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.