dist2full {nnspat}R Documentation

Converts a lower triangular distance matrix to a full distance matrix

Description

Converts a lower triangular distance matrix to a full distance matrix with zeroes in the diagonal. The input is usually the result of the dist function in the stats package. This function is adapted from Everitt's book (Everitt (2004))

Usage

dist2full(dis)

Arguments

dis

A lower triangular matrix, resulting from the dist function in the stats package

Value

A square (symmetric) distance matrix with zeroes in the diagonal.

Author(s)

Elvan Ceyhan

References

Everitt BS (2004). An R and S-Plus Companion to Multivariate Analysis. Springer-Verlag, London, UK.

See Also

dist

Examples

#3D data points
n<-3
X<-matrix(runif(3*n),ncol=3)
dst<-dist(X)
dist2full(dst)


[Package nnspat version 0.1.2 Index]