distance: Calculate Euclidean distance between pairs of points
Description
Calculate the Euclidean distance between pairs of points
and return a distance matrix
Usage
distance(X1, X2 = NULL)
Arguments
X1
a matrix or data.frame containing real-valued
numbers
X2
an optional matrix or data.frame containing real-valued
numbers; must have ncol(X2) = ncol(X1)
Value
The output is a matrix, whose dimensions are described in the Details
section above.
Details
If X2 = NULL distances between X1 and itself are
calculated, resulting in an nrow(X1) x nrow(X1) distance
matrix. Otherwise the result is nrow(X1) x nrow(X2) and
contains distances between X1 and X2.