Computes the index of the peak acceleration of a trajectory,
defined by vectors of x and y coordinates, and assumed to be equidistant
in time.
Usage
index_max_acceleration(x_vector, y_vector, absolute = FALSE)
Arguments
- x_vector
x-coordinates of the executed path.
- y_vector
y-coordinates of the executed path.
- absolute
Should negative accelerations (i.e., deceleration)
be included? Defaults to FALSE
.
Value
Single number indicating the index of peak acceleration (1 to +Inf).
Details
The supplied vectors are assumed to be ordered by time with equal
time differences.
References
Pfister, R., Tonn, S., Schaaf, M., Wirth, R. (2024).
mousetRajectory: Mouse tracking analyses for behavioral scientists.
The Quantitative Methods for Psychology, 20(3), 217-229.
doi:10.20982/tqmp.20.3.p217
Examples
x_vals <- c(0, 1, 2, 3, 6, 10, 12, 14, 15)
y_vals <- c(0, 0, 0, 0, 0, 0, 0, 0, 0)
index_max_acceleration(x_vals, y_vals)
#> [1] 4
# acceleration maximal between x_vals[4] and x_vals[5]