add_mahalanobis | R Documentation |
Add a mahalanobis distance to the end of a data frame.
add_mahalanobis( df, ..., .inverted = FALSE, .name = "md", .p = "p_value", tolerance = .Machine$double.eps )
df |
A data.frame |
... |
Columns to select |
.inverted |
Logical. If TRUE, covariance matrix (p x p) of the distribution is supposed to contain the inverse of the covariance matrix. |
.name |
The name of the new column for the distance value |
.p |
The name for the new column for the p-value calculation |
tolerance |
'tol' in [base::solve()] |
df <- head(iris) add_mahalanobis(df, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) df[1, ] <- NA_real_ add_mahalanobis(df, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.