get_dists: Retrieve the distances between i and j from a 'dist' object.

Description Usage Arguments Value Examples

Description

Retrieve the distances between i and j from a 'dist' object.

Usage

1
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

1
2
3
4
test <- matrix(rnorm(20), ncol = 2)
test_dists <- dist(test)
indices <- matrix(sample(1:8),ncol=2)
get_dists(test_dists, indices)

disttools documentation built on May 2, 2019, 9:59 a.m.