distEuclidean: Euclidean Distance

Description Usage Arguments Value See Also Examples

View source: R/distEuclidean.R

Description

Calculates the Euclidean distance between two matrices with k columns.

Usage

1

Arguments

x

a matrix of size n x k.

y

a matrix of size m x k.

Value

a distance matrix of size n x m.

See Also

dist

Examples

1
2
3
4
5
6
7
8
9
## The function is currently defined as
function (x, y) 
{
    z <- matrix(0, nrow = nrow(x), ncol = nrow(y))
    for (k in 1:nrow(y)) {
        z[, k] <- sqrt(colSums((t(x) - y[k, ])^2))
    }
    return(z)
  }

rintakumpu/custom-kmeans documentation built on May 3, 2019, 10:45 p.m.