[R] dist
Paulo Justiniano Ribeiro Jr
p.ribeiro at lancaster.ac.uk
Mon Nov 19 15:21:30 CET 2001
Hi Agustin
You mingth not need this after Brain's reply but just in case...
The package geoR has a function which might help
loccoords(coords, locations)
where the arguments are 2 column matrices with coordinates.
The function which returns the distance between each element of coords
(centroids) to each element of locations(individuals)
The function is just a "wrapper" to a piece of C code
Cheers
P.J.
On Mon, 19 Nov 2001, Agustin Lobo wrote:
>
> Hi list!
>
> I'm computing multivar. distances from a set of centroids
> to a (large) set of individuals. I'm now just using rbind
> to create a matrix (x) with the centroid and the individuals,
> then run as.matrix(dist(x)) and finally select the appropriate columns,
> as I'm not interested on the distances among individuals.
> Therefore, this procedure implies a waste of computing time.
> Is there any way to use dist only between each individual
> and the centroids (avoiding loops in R)? or should I just go and try to
> make
> a modified version of dist by hacking the C code?
>
> Thanks
>
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
Paulo Justiniano Ribeiro Jr
Dept Maths & Stats - Fylde College
Lancaster University
Lancaster LA1 4YF - U.K.
e-mail: Paulo.Ribeiro at est.ufpr.br
http://www.maths.lancs.ac.uk/~ribeiro
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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