Given a set of locations defining a trajectory, this function computes the linear accelerations between each pair of successive locations along the trajectory.
Arguments
- x
A vector of x (or longitude) coordinates corresponding to a single trajectory.
- y
A vector of y (or latitude) coordinates corresponding to a single trajectory.
- t
A vector of timestamps corresponding to a single trajectory.
- geo
A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.
Value
A vector of the same length as x and y corresponding to the linear accelerations between each pair of successive locations along the trajectory.
Author
Simon Garnier, garnier@njit.edu
Examples
x <- rnorm(25)
y <- rnorm(25, sd = 3)
t <- as.POSIXct(1:25, origin = Sys.time())
linear_acc(x, y, t)
#> [1] NA NA 2.57227605 -2.51082828 -1.34594545
#> [6] 3.92583664 3.38706444 10.42133574 -14.51124096 0.03247317
#> [11] 2.57103979 -6.09390115 1.30357381 1.10422518 3.89386637
#> [16] 0.49263023 2.24426366 -3.52656466 -3.63972236 5.11695619
#> [21] -4.51166445 -2.14925989 1.94022297 -1.59972106 2.31142097