Calculate Generalized Minkowski Distance Between Two Vectors
Source:R/distanceMatrix.R
metricDistance.Rd
This function calculates the generalized Minkowski distance of order 'n' between two numeric vectors. This distance is a metric in a normed vector space which generalizes the Euclidean and Manhattan distances. It is used for various data science applications, particularly in clustering, optimization, and outlier detection in complex systems.
Arguments
- vec1
Numeric vector, the first vector for which the distance will be calculated.
- vec2
Numeric vector, the second vector for which the distance will be calculated.
- n
Integer, the order of the Minkowski distance. When n=2, it becomes the Euclidean distance; when n=1, it becomes the Manhattan distance.