distancia {dprep}R Documentation

Vector-Vector Euclidiean Distance Function

Description

Finds the euclidean distance between two vectors x and y, or the matrix y and the vector x

Usage

distancia(x, y)

Arguments

x numeric vector
y numeric vector or matrix

Details

Does not support missing values. If y is a column of a vector, the transpose must be used.

Value

distancia numeric value representing the Euclidean distance between x and y, or a row matrix representing the Euclidean distance between x and each column of y.

Author(s)

Caroline Rodriguez and Edgar Acuna

Examples

#---- Calculating distances
x=rnorm(4)
y=matrix(rnorm(12),4,3)
distancia(x,t(y[,1]))
distancia(x,y)


[Package dprep version 1.0 Index]