Description Usage Arguments Value Examples
get_velocity
calculate the velocity of a vector using either the velocity from one point to the next or the method used in the
saccades package which calculates velocity based on surrounding points.
1 | get_velocity(x, smooth = 1, method = 1)
|
x |
vector of coordinates to calculate velocity between |
smooth |
number of leading points to smooth velocity by. If smooth = 1 the output will not be smoothed |
method |
the method to use. 1 is the velocity to the next point, 2 is based on both previous and next point but ignoring current point. |
Returns a vector of velocities
1 2 3 | x <- sort(runif(5, 0, 10))
x <- c(x, rev(x))
get_velocity(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.