[R] multivariate distance and apply

Agustin Lobo alobo at ija.csic.es
Mon Jul 23 17:27:34 CEST 2001


I'm computing a mutivariate distance that is
not among the different options of dist. Hence
I've written
where v1 and v2 are vectors.

Now, I have to calculate the distances between
one given vector (V1) and a number of vectors
arranged as the rows of a matrix (stat). I'm

apply(stat, 1, midistancia, V1)

to apply midstancia to each row of stat.

The question is: is this the most efficient method
in R or is there a faster way to calculate midistancia
between V1 and the rows of stat?
(stat can become ~80000 rows x 7 cols)



Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list