[R] multivariate distance and apply

About this list Date view Thread view Subject view Author view Attachment view

From: Agustin Lobo (alobo@ija.csic.es)
Date: Tue 24 Jul 2001 - 01:27:34 EST


Message-id: <Pine.OSF.3.96.1010723172556.24289A-100000@ija.csic.es>


Hi!

I'm computing a mutivariate distance that is
not among the different options of dist. Hence
I've written
midistancia(v1,v2)
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
using

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)

Thanks

Agus

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@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 10 Mar 2004 - 08:18:21 EST