Distance Function Constructors
distance-constructors.RdThese convenience functions build specific types of distance function objects via create_dist.
Each returns an S3 object inheriting from c("<method>", "distfun").
Arguments
- labels
Optional vector of row labels (not directly used in distance calculation).
- method
For
cordist, the correlation method: "pearson" or "spearman".- ncomp
For
pcadist, the number of components (or a function threshold).- whiten
For
pcadist, whether to whiten principal components (logical).- threshfun
For
pcadist, an optional function that determines how many PCs to retain based onpres$sdev^2.- dist_method
For
pcadist, the base distance measure in PC space ("euclidean", "manhattan", or "cosine").
Details
- cordist(labels, method="pearson") -> correlation-based distance.
- mahadist(labels) -> Mahalanobis distance.
- eucdist(labels) -> Euclidean distance.
- robustmahadist(labels) -> Mahalanobis distance using robust covariance.
- pcadist(labels, ...) -> distance in reduced PCA space.
See also
create_dist for the underlying constructor.