distMatrix {phm} | R Documentation |
Calculate a Distance Matrix
Description
Calculate a distance matrix for a numeric matrix, where a distance function
is used to calculate the distance between all combinations of the columns
of the matrix M
.
Usage
distMatrix(M, fn = "textDist", ...)
Arguments
M |
A numeric matrix |
fn |
The name of a distance function, default is "textDist". |
... |
Additional arguments to be passed to the distance function |
Value
The distance matrix with the distance between all combinations
of the columns of M
according to the distance function in fn
.
Examples
M=matrix(c(0,1,0,2,0,10,0,14,12,0,8,0,1,0,1,0),4)
colnames(M)=1:4;rownames(M)=c("A","B","C","D")
M
#Text distance matrix
distMatrix(M)
#Canberra distance matrix
distMatrix(M,"canberra")
[Package phm version 1.1.2 Index]