get_dists {disttools} | R Documentation |
Retrieve the distances between i and j from a 'dist' object.
Description
Retrieve the distances between i and j from a 'dist' object.
Usage
get_dists(x, i, j = NULL, return_indices = FALSE)
Arguments
x |
An object of class 'dist'. |
i |
Either a two column matrix of integer indices or a vector of indices that are paired with the corresponding elements in j. |
j |
A vector of indices where each element forms a pair with the corresponding element in argument i. |
return_indices |
Logical indicating whether a three column matrix containing the provided indices (columns 1 and 2) and their corresponding distances (column 3) should be returned. The default behavior is to return a vector of distances. |
Value
A vector giving the distances between the provided indices.
Examples
test <- matrix(rnorm(20), ncol = 2)
test_dists <- dist(test)
indices <- matrix(sample(1:8),ncol=2)
get_dists(test_dists, indices)
[Package disttools version 0.1.8 Index]