distMatrix | R Documentation |
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
.
distMatrix(M, fn = "textDist", ...)
M |
A numeric matrix |
fn |
The name of a distance function, default is "textDist". |
... |
Additional arguments to be passed to the distance function |
The distance matrix with the distance between all combinations
of the columns of M
according to the distance function in fn
.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.