linear_dist: Linear Distances

View source: R/dist.R

linear_distR Documentation

Linear Distances

Description

Given a set of locations defining a trajectory, this function computes the linear distances between each pair of successive locations along the trajectory.

Usage

linear_dist(x, y, geo = FALSE)

linDist(x, y, 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.

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 distances between each pair of successive locations along the trajectory.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

linear_speed, linear_acc, nsd

Examples

x <- rnorm(25)
y <- rnorm(25, sd = 3)
linear_dist(x, y)


swarm-lab/swaRm documentation built on Dec. 3, 2023, 9:30 p.m.