Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

distances

Computes distance between pairs of locations


Description

This function computes euclidean distance or distance vector for each pair of a set of spatial locations.

Usage

distance(coord, vec = FALSE)

Arguments

coord

A matrix representing the coordinates of each locations. Each row corresponds to one location.

vec

Logical. If FALSE (default), the euclidean distance is computed. Otherwise, “distance vectors” are returned.

Value

If vec = FALSE, this function returns a vector that gives the euclidean distance for each pair of locations. Otherwise, this is a matrix where each column correspond to one dimension - i.e. longitude, latitude, ...

Author(s)

Mathieu Ribatet

See Also

Examples

coords <- cbind(seq(0, 10, by = 2), seq(10, 0, by = -2))
distance(coords)
distance(coords, vec = TRUE)

SpatialExtremes

Modelling Spatial Extremes

v2.0-9
GPL (>= 2)
Authors
Mathieu Ribatet [aut, cre], Richard Singleton [ctb], R Core team [ctb]
Initial release
2020-09-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.