distance | R Documentation |
This function computes euclidean distance or distance vector for each pair of a set of spatial locations.
distance(coord, vec = FALSE)
coord |
A matrix representing the coordinates of each locations. Each row corresponds to one location. |
vec |
Logical. If |
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
coords <- cbind(seq(0, 10, by = 2), seq(10, 0, by = -2)) distance(coords) distance(coords, vec = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.