euclidean: Euclidean distance metric.

Description Usage Arguments Details Value Author(s) Examples

Description

Euclidean distance between two vectors.

Usage

1
euclidean(v1, v2)

Arguments

v1

Source vector.

v2

Target vector.

Details

Note: There is also a dist function in R with the options for euclidian, maximum, manhatten, canberra, binary and minkowski metrics.

Value

Euclidean distance.

Author(s)

phil

Examples

1
2
3
4
5
6
7
8
9
# (3,4) with (9,12)
euclidean(c(3, 4), c(9, 12))

# (3,4) with (44,66)
euclidean(c(3, 4), c(44, 66))

# (3,4) with (9,12) and (44,66)
m <- matrix(c(9, 12, 44, 66), ncol=2, byrow=TRUE)
apply(m, 1, euclidean, c(3, 4))

phil8192/lazy-iris documentation built on May 25, 2019, 2:56 a.m.