Learn R Programming

swaRm (version 0.6.0)

heading: Headings

Description

Given a set of locations defining a trajectory, this function approximates their instantaneous headings computed as the direction of the vectors between successive locations along the trajectory.

Usage

heading(x, y, geo = FALSE)

Value

A vector of the same length as x and y corresponding to the approximated headings 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.

geo

A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.

Author

Simon Garnier, garnier@njit.edu

See Also

ang_speed, ang_acc

Examples

Run this code
x <- rnorm(25)
y <- rnorm(25, sd = 3)
heading(x, y)

Run the code above in your browser using DataLab