dist_subset {usedist}R Documentation

Extract parts of a dist object.

Description

Extract a subset of values from a distance matrix. This function also works to re-arrange the rows of a distance matrix, if they are provided in the desired order.

Usage

dist_subset(d, idx)

Arguments

d

A distance matrix object of class dist.

idx

Indices specifying the subset of distances to extract.

Value

A distance matrix.

Examples

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

[Package usedist version 0.4.0 Index]