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

chebyshev

Chebyshev distance


Description

The Chebyshev distance is the maximum absolute difference between the vector elements.

Usage

chebyshev(x, y)

Arguments

x, y

Numeric vectors

Details

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

d(x, y) = \max_i |x_i - y_i|.

Relation to other definitions:

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

Value

The Chebyshev distance between x and y.

Examples

x <- c(15, 6, 4, 0, 3, 0)
y <- c(10, 2, 0, 1, 1, 0)
chebyshev(x, y) # should be 5

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.