You can supply timestamps to min_time and max_time (e.g timestamp of begin escape) to average over only a period.

extract_gaze_elevation(
  df,
  min_time = min(df$time, na.rm = TRUE),
  max_time = max(df$time, na.rm = TRUE),
  samplingrate = NULL,
  direction = c(0, 0, 1)
)

Arguments

df

A movement or eyetracker data frame. Expected columns are either rot_x, rot_y, rot_z, or gaze_direction_x, gaze_direction_y, gaze_direction_z

min_time

minimum time in s (default: trial start)

max_time

maximum time in s (default: trial end)

samplingrate

resampling rate

direction

Gaze reference vector (default: forward)

Value

Average gaze elevation in degrees, between min_time and max_time.

Details

NOTE: to avoid an impact of tracker glitches, data are resampled at default rate of 10 Hz (movement) or 100 Hz (gaze) and median-smoothed over 3 data points (300 or 30 ms).