Interpolate missing gaze data (X and Y) within trials, with optional max gap

Description

Interpolate missing gaze data (X and Y) within trials, with optional max gap

Usage

interpolate_gaze(
  x,
  x_col = "Gaze_X",
  y_col = "Gaze_Y",
  trial_col = "Trial",
  subject_col = "Subject",
  time_col = "Time",
  max_gap = Inf
)

Arguments

x A data frame containing gaze data.
x_col The name of the X gaze column (as string).
y_col The name of the Y gaze column (as string).
trial_col The name of the trial column (default = "Trial").
subject_col The name of the subject column (default = "Subject").
time_col The name of the time column used for sorting (default = "Time").
max_gap Maximum number of consecutive missing samples to interpolate. Gaps larger than this remain NA (default = Inf).

Value

A tibble with interpolated gaze X and Y columns (replacing originals).