distant | R Documentation |
Convert a similarity matrix into a distance matrix.
distant(s, t = FALSE)
s |
a similarity matrix |
t |
return the same matrix if t=FALSE |
For better resultas, use the parameter distance in sim
function.
A distance matrix.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From a random incidence matrix I(25X4)
I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4,
dimnames = list(NULL, c("A", "B", "C", "D")))
J <- sim(I, "Jaccard")
distant(J, t = TRUE)
#Same results
sim(I, "Jaccard", distance = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.