dist_get: Retrieve distances from a 'dist' object.

Description Usage Arguments Value Examples

Description

Retrieve distances from a dist object.

Usage

1
dist_get(d, idx1, idx2)

Arguments

d

A distance matrix object of class dist.

idx1, idx2

Indices specifying the distances to extract.

Value

A vector of distances.

Examples

1
2
3
4
5
m4 <- matrix(1:16, nrow=4, dimnames=list(LETTERS[1:4]))
dm4 <- dist(m4)
dist_get(dm4, "A", "C")
dist_get(dm4, "A", c("A", "B", "C", "D"))
dist_get(dm4, c("A", "B", "C"), c("B", "D", "B"))

Example output

[1] 4
[1] 0 2 4 6
[1] 2 4 2

usedist documentation built on March 2, 2020, 1:07 a.m.