Learn R Programming

distantia (version 2.0.0)

distance: Distance Between Two Numeric Vectors

Description

Computes the distance between two numeric vectors with a distance metric included in the data frame distantia::distances.

Usage

distance(x = NULL, y = NULL, distance = "euclidean")

Value

numeric value

Arguments

x

(required, numeric vector).

y

(required, numeric vector) of same length as x.

distance

(optional, character string) name or abbreviation of the distance method. Valid values are in the columns "names" and "abbreviation" of the dataset distances. Default: "euclidean".

See Also

Other distances: distance_matrix(), distances

Examples

Run this code

distance(
  x = runif(100),
  y = runif(100),
  distance = "euclidean"
)

Run the code above in your browser using DataLab