R: Computes distance between pairs of locations

distance {SpatialExtremes} | R Documentation

## 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

`dist`

### Examples

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

[Package SpatialExtremes version 2.0-5 Index]