# distances: Computes distance between pairs of locations In SpatialExtremes: Modelling Spatial Extremes

## Description

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

## Usage

 `1` ```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, ...

Mathieu Ribatet

`dist`

## Examples

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

### Example output

``` [1]  2.828427  5.656854  8.485281 11.313708 14.142136  2.828427  5.656854
[8]  8.485281 11.313708  2.828427  5.656854  8.485281  2.828427  5.656854
[15]  2.828427
[,1] [,2]
[1,]    2   -2
[2,]    4   -4
[3,]    6   -6
[4,]    8   -8
[5,]   10  -10
[6,]    2   -2
[7,]    4   -4
[8,]    6   -6
[9,]    8   -8
[10,]    2   -2
[11,]    4   -4
[12,]    6   -6
[13,]    2   -2
[14,]    4   -4
[15,]    2   -2
```

SpatialExtremes documentation built on May 2, 2019, 5:45 p.m.