pdist: Pairwise Distance Matrix

View source: R/nn.R

pdistR Documentation

Pairwise Distance Matrix

Description

Given a set of locations, this function computes the distances between each possible pair of locations.

Usage

pdist(x, y, geo = FALSE)

Arguments

x

A vector of x (or longitude) coordinates.

y

A vector of y (or latitude) coordinates.

geo

A logical value indicating whether the locations are defined by geographic coordinates (pairs of longitude/latitude values). Default: FALSE.

Value

A square matrix representing pairwise distances between each possible pair of locations.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

nn, nnd

Examples

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


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