Apply a moving average smoothing function to gaze data (X and Y). This is generally recommended after up-sampling the data.

Description

Apply a moving average smoothing function to gaze data (X and Y). This is generally recommended after up-sampling the data.

Usage

smooth_gaze(
  x,
  n = 5,
  x_col = "Gaze_X",
  y_col = "Gaze_Y",
  trial_col = "Trial",
  subject_col = "Subject"
)

Arguments

x A data frame containing gaze data.
n The window size (in samples) for the moving average.
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 used for grouping (default = "Trial").
subject_col The name of the subject column used for grouping (default = "Subject").

Value

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