Calculate Out-of-Bounds Proportion by Subject and Trial

Description

This function calculates the number and percentage of gaze points that fall outside the screen dimensions, and optionally removes only the out-of-bounds gaze points.

Usage

gaze_oob(
  data,
  subject_col = "subject",
  trial_col = "trial",
  x_col = "x",
  y_col = "y",
  screen_size = c(1, 1),
  remove = FALSE
)

Arguments

data A data frame containing gaze data.
subject_col A string specifying the name of the column that contains the subject identifier. Default is "subject".
trial_col A string specifying the name of the column that contains the trial identifier. Default is "trial".
x_col A string specifying the name of the column that contains the X coordinate. Default is "x".
y_col A string specifying the name of the column that contains the Y coordinate. Default is "y".
screen_size A numeric vector of length 2 specifying the screen width and height. Default is c(1, 1) assuming normalized coordinates.
remove Logical; if TRUE, removes points outside of screen dimensions. Default is FALSE.

Value

A list containing:

subject_results
Summary of missingness at the subject level.
trial_results
Summary of missingness at the trial level.
data_clean
Dataset with optional removal of out-of-bounds points and missingness annotations.