Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

minkowski

Minkowski distance


Description

The Minkowski metric is a generalized form of Euclidean (p=2) and Manhattan (p=1) distance.

Usage

minkowski(x, y, p = 1)

Arguments

x, y

Numeric vectors.

p

Exponent parameter, a single number greater than zero.

Details

For vectors x and y, the Minkowski distance is defined as

d(x, y) = ≤ft( ∑_i |x_i - y_i|^p \right)^{1/p}.

Relation to other definitions:

  • Equivalent to R's built-in dist() function with method = "minkowski".

  • Equivalent to the minkowski() function in scipy.spatial.distance.

  • Equivalent to D_6 in Legendre & Legendre.

The default value of p = 1 makes this distance equal to the Manhattan distance.

Value

The Minkowski distance between x and y.


abdiv

Alpha and Beta Diversity Measures

v0.2.0
MIT + file LICENSE
Authors
Kyle Bittinger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.