distancia {dprep} | R Documentation |
Finds the euclidean distance between two vectors x and y, or the matrix y and the vector x
distancia(x, y)
x |
numeric vector |
y |
numeric vector or matrix |
Does not support missing values. If y is a column of a vector, the transpose must be used.
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. |
Caroline Rodriguez and Edgar Acuna
#---- Calculating distances x=rnorm(4) y=matrix(rnorm(12),4,3) distancia(x,t(y[,1])) distancia(x,y)