mahalanobis_pairwise <- function(data) {
out <- lapply(1:nrow(data), function(i) {
mahalanobis(x = data,
center = do.call("c", data[i, ]),
cov = cov(data))
})
return(as.dist(do.call("rbind", out)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.