Learn R Programming

nnspat (version 0.1.2)

dist2full: 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;textualnnspat)

Usage

dist2full(dis)

Value

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

Arguments

dis

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

Author

Elvan Ceyhan

References

See Also

Examples

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

Run the code above in your browser using DataLab