Description Usage Arguments Value Examples
Calculates a Mahalanobis distance of a dataframe or a matrix. Option for robust centroid location.The Mahalanobis distance is a measure of distance between a point and a distribution. In this simplified case it's the difference between each point and centroid of the distribution produced by the points.
1 | mahal_dist(x, center = "mean", na.rm = TRUE)
|
x |
Dataframe or matrix of numerical values |
center |
Method to calculate distribution center, either mean or median |
na.rm |
Whether to remove missing values for centroid calculation |
vector of distances
1 2 3 4 5 | data(iris)
iris_values <- iris[,1:4]
mahal_dist(iris_values)
mahal_dist(iris_values, center = "median")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.