You can supply timestamps to min_time and max_time (e.g timestamp of begin escape) to average over only a period. In both cases, you can either retrieve peak or average (default) three-dimensional speed.

extract_speed(
  df,
  min_time = min(df$time, na.rm = TRUE),
  max_time = max(df$time, na.rm = TRUE),
  method = "mean",
  samplingrate = 10,
  dimension = "3D"
)

Arguments

df

A movement data frame. Expected columns are pos_x, pos_y, pos_z

min_time

minimum time in s (default: trial start)

max_time

maximum time in s (default: trial end)

method

whether to extract mean (default) or max

samplingrate

resampling rate

dimension

"3D" (default) or "2D" (only horizontal speed)

Value

Peak or average 3-dimensional speed, between min_time and max_time.

Details

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