pairDist {omnibus} | R Documentation |
Calculate pairwise distances between two matrices or data frames.
Description
This function takes two data frames or matrices and returns a matrix of pairwise Euclidean distances between the two.
Usage
pairDist(x1, x2 = NULL, na.rm = FALSE)
Arguments
x1 |
Data frame or matrix one or more columns wide. |
x2 |
Data frame or matrix one or more columns wide. If |
na.rm |
Logical, if |
Value
Matrix with nrow(x1)
rows and nrow(x2)
columns. Values are the distance between each row of x1
and row of x2
.
See Also
Examples
x1 <- data.frame(x=sample(1:30, 30), y=sort(round(100 * rnorm(30))), z=sample(1:30, 30))
x2 <- data.frame(x=1:20, y=round(100 * rnorm(20)), z=sample(1:20, 20))
pairDist(x1, x2)
pairDist(x1)
[Package omnibus version 1.2.13 Index]