distancia: Vector-Vector Euclidiean Distance Function

Description Usage Arguments Details Value Author(s) Examples

View source: R/distancia.R

Description

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

Usage

1
distancia(x, y)

Arguments

x

A numeric vector

y

A numeric vector or matrix

Details

Does not support missing values.

Value

distancia

The result is a numeric value representing the Euclidean distance between x and y, or a row matrix representing the Euclidean distance between x and each row of y.

Author(s)

Caroline Rodriguez and Edgar Acuna

Examples

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

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
[1] 2.691626
         [,1]     [,2]     [,3]     [,4]
[1,] 1.902473 2.230908 1.626766 2.161939

dprep documentation built on May 29, 2017, 11:01 a.m.