cordist | R Documentation |
These convenience functions build specific types of distance function objects via create_dist
.
Each returns an S3 object inheriting from c("<method>", "distfun")
.
cordist(labels = NULL, method = c("pearson", "spearman"))
mahadist(labels = NULL)
eucdist(labels = NULL)
robustmahadist(labels = NULL)
pcadist(
labels = NULL,
ncomp = 2,
whiten = TRUE,
threshfun = NULL,
dist_method = c("euclidean", "manhattan", "cosine")
)
labels |
Optional vector of row labels (not directly used in distance calculation). |
method |
For |
ncomp |
For |
whiten |
For |
threshfun |
For |
dist_method |
For |
- 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.
An S3 object with class c("<method>", "distfun")
.
create_dist
for the underlying constructor.
dist_obj_1 <- cordist(method="pearson")
dist_obj_2 <- mahadist()
dist_obj_3 <- eucdist()
dist_obj_4 <- robustmahadist()
dist_obj_5 <- pcadist(ncomp=2, dist_method="cosine")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.