aoi_test: Test whether a gaze coordinates are within or outside a...

View source: R/AnalysisFunctions.R

aoi_testR Documentation

Test whether a gaze coordinates are within or outside a rectangular or elliptical AOI. The data fram aois must contain variables with minimum x, minimum y, maximum x, and maximum y values and type where rect or rectangle means that the AOI is a rectangle and ellipse or circle that the AOI is an ellipse The coordinate variables must be named: x0 OR xmin: minimum x value x1 OR xmax: maximum x value y0 OR ymin: minimum y value y1 OR ymax: maximum y value If a column called name is present, the output for each AOI will be labelled accordingly. Otherwise, the output will be labelled according to the order of the AOI in the data frame. The df 'gaze' must contain the variables onset, duration, x, and y. Latency will be defined as the value in onset of the first detected gaze coordinate in the AOI Make sure that the timestamps are correct! The function can be used with gaze data either fixations, saccades, or single samples. Note that the output variables are not equally relevant for all types of gaze data. For example, both total duration and latency are relevant in many analyses focusing on fixations, but total duration may be less relevant in analyses of saccades.

Description

Test whether a gaze coordinates are within or outside a rectangular or elliptical AOI. The data fram aois must contain variables with minimum x, minimum y, maximum x, and maximum y values and type where rect or rectangle means that the AOI is a rectangle and ellipse or circle that the AOI is an ellipse The coordinate variables must be named: x0 OR xmin: minimum x value x1 OR xmax: maximum x value y0 OR ymin: minimum y value y1 OR ymax: maximum y value If a column called name is present, the output for each AOI will be labelled accordingly. Otherwise, the output will be labelled according to the order of the AOI in the data frame. The df 'gaze' must contain the variables onset, duration, x, and y. Latency will be defined as the value in onset of the first detected gaze coordinate in the AOI Make sure that the timestamps are correct! The function can be used with gaze data either fixations, saccades, or single samples. Note that the output variables are not equally relevant for all types of gaze data. For example, both total duration and latency are relevant in many analyses focusing on fixations, but total duration may be less relevant in analyses of saccades.

Usage

aoi_test(gaze, aois, outside = FALSE)

Arguments

gaze

data frame with each row representing a gaze coordinate from a fixation, saccade, or sample. Must include the variables x, y, duration, and onset. Onset zero should typically be trial onset

aois

data frame with AOIs.

outside

If FALSE, summarize data within AOIs. If TRUE, summarize data outside AOIs.

Value

data frame with total duration, number of occurrences and latency to first detected gaze coordinates for each AOI. Data are in long format.


kollaR documentation built on May 8, 2026, 5:07 p.m.