Learn R Programming

evclust (version 2.0.3)

createD: Computation of a Euclidean distance matrix

Description

createD constructs an n x k matrix of Euclidean distances from an n x p matrix of attribute data. For each object, the distances to k randomly selected objects are computed.

Usage

createD(x, k)

Value

A list with two elements:

D

n x k distance matrix.

J

n x k matrix of indices. D[i,j] is the Euclidean distance between x[i,] and x[J[i,j],].

Arguments

x

n x p data matrix.

k

Number of distances. If missing, an n x n distance matrix is computed.

See Also

kevclus

Examples

Run this code
data(fourclass)
x<-as.matrix(fourclass[,1:2])
dist<-createD(x,k=10)
dim(dist$D)
dim(dist$J)

Run the code above in your browser using DataLab