nnba {swaRmverse}R Documentation

Bearing Angle to Nearest Neighbor

Description

Given the locations and headings of different objects, this function determines the angle between the heading of each object and the position to the nearest neighboring object.

Usage

nnba(x, y, hs, geo = FALSE)

Arguments

x

A vector of x (or longitude) coordinates.

y

A vector of y (or latitude) coordinates.

hs

A vector of headings (angle in rads).

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 representing the distance to the nearest neighboring object for each object.

Author(s)

Simon Garnier, garnier@njit.edu, Marina Papadopoulou, m.papadopoulou.rug@gmail.com

See Also

pdist

Examples

x <- rnorm(25)
y <- rnorm(25, sd = 3)
hs <- rnorm(25, sd = 1)
nnba(x, y, hs)


[Package swaRmverse version 0.1.0 Index]