computeIdxFromDistIdx: Indices of two samples of given index into distance matrix.

computeIdxFromDistIdxR Documentation

Indices of two samples of given index into distance matrix.

Description

computeIdxFromDistIdx computes the indices of two points whose distance appears at given position in a distance matrix (as computed by dist).

Usage

computeIdxFromDistIdx(n, 
    i)

Arguments

n

number of points

i

index into the distance matrix

Value

a vector of two indices of points whose distance appears at given position in a distance matrix.

Author(s)

Tomas Sieger

See Also

computeDistIdx

Examples

x <- 1:10
d <- dist(x)

# entries holding distances between point 3 and 7
i<-computeDistIdx(length(x), 3, 7)
print(i)

# restore indices of the points:
ii<-computeIdxFromDistIdx(length(x), i)
print(ii)


tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.