[R-sig-Geo] inter-point distance calcs

Kamran Safi ksafi at orn.mpg.de
Mon Aug 10 20:33:57 CEST 2009


Hi all,

just a short notice:

dist() is euclidean distance while spDistN1 can take longitude and 
latitude and deliver great circle distance, which is quite something 
else for large distances.
Also, as far as I remember the library(argosfilter) provides some 
distance measures for positions.

Kami


Jim Bouldin wrote:
> Good grief, yes dist() will do quite nicely.  Pardon the more or less
> continuous brain lock while I learn R.  Thanks.
> Jim
>
>   
>> On Monday 10 August 2009, Jim Bouldin wrote:
>>     
>>> Can anyone recommend a package that can calculate the distances between
>>> points (either all or a defined sample of) for x,y point locations
>>>       
>> listed
>>     
>>> in long format?  Thanks in advance.
>>>
>>>       
>> Sure. How about the function dist():
>>
>> d <- data.frame(x=sample(1:10, 5), y=sample(1:10, 5))
>>
>> dist(d)
>>          1        2        3        4
>> 2 3.605551                           
>> 3 6.403124 7.071068                  
>> 4 9.219544 7.211103 5.830952         
>> 5 8.062258 5.099020 7.211103 3.162278
>>
>>
>> Cheers,
>> Dylan
>>
>>
>> -- 
>> Dylan Beaudette
>> Soil Resource Laboratory
>> http://casoilresource.lawr.ucdavis.edu/
>> University of California at Davis
>> 530.754.7341
>>
>>     
>
> Jim Bouldin, PhD
> Research Ecologist
> Department of Plant Sciences, UC Davis
> Davis CA, 95616
> 530-554-1740
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3275 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20090810/7ffcaca4/attachment.bin>


More information about the R-sig-Geo mailing list