This function applies scaling to the columns of a data frame and computes and returns a distance matrix from a chosen distance measure.
compute_dmat(
x,
dist_method = "euclidean",
apply_scaling = FALSE,
subset_cols = NULL
)
a numeric data frame or matrix
a distance measure to apply to the scaled data. Must be those supported by stats::dist()
, plus "mahalanobis"
and "cosine"
. Default is "euclidean"
.
use TRUE to apply base::scale()
. By default does not scale data.
(optional) a list of columns to subset the data
an object of class "dist" (see stats::dist()
)