pairDist | R Documentation |
This function takes two data frames or matrices and returns a matrix of pairwise Euclidean distances between the two.
pairDist(x1, x2 = NULL, na.rm = FALSE)
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 |
Matrix with nrow(x1)
rows and nrow(x2)
columns. Values are the distance between each row of x1
and row of x2
.
dist
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.