Skip to contents

Given a set of locations defining a trajectory, this function approximates their instantaneous instantaneous angular speeds computed as the difference between successive headings divided by the time between these successive headings.

Usage

ang_speed(x, y, t, geo = FALSE)

angSpeed(x, y, t, geo = FALSE)

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, y and t corresponding to the approximated instantaneous angular speeds along the trajectory.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

x <- rnorm(25)
y <- rnorm(25, sd = 3)
t <- as.POSIXct(1:25, origin = Sys.time())
ang_speed(x, y, t)
#>  [1]         NA         NA  1.0453698  2.4359684  2.8847242  0.0577974
#>  [7] -2.8722883 -0.4654643  1.2958490 -3.0284013 -2.7203884  1.9972050
#> [13]  2.8402990 -0.2308750 -3.0501015 -0.1410135 -3.0359444 -0.3844565
#> [19] -2.8368930 -0.4656028 -2.9640589  1.1543182  2.5608694  3.0630419
#> [25] -1.9425550