euclidean: Euclidean distance matrice between points

Description Usage Arguments Value Examples

View source: R/euclidean.R

Description

Computes the Euclidean distance between n points in m dimensions ,or two points with same dimensions.

Usage

1
euclidean(x, y, w = 1, output = "matrix")

Arguments

x

Numeric vector, or a matrix with size n x m.

y

(optional)Numeric vector; must be the same length as x. If no input of y, please specify all other parameters to avoid confusion.

w

Numeric value greater than 0, account for weight. Default is 1.

output

Format of output, either matrix or dist object. Default is matrix.

Value

Euclidean distance matrix or object calculated by sqrt(sum((x - y) ^ 2)) between points

Examples

1
2
3
euclidean(x = matrix(c(1, 2, 3, 4), 2, 2), output = "dist")

euclidean(rnorm(10), rnorm(10), w = 2)

yingtliu/distPack documentation built on Jan. 1, 2021, 1:45 p.m.