[R] Using earth.dist function

Rolf Turner rolf.turner at xtra.co.nz
Tue Feb 21 21:21:32 CET 2012


Please do the following:

     install.packages("fortunes")
     require("fortunes")
     fortune("brain surgery")

     cheers,

         Rolf Turner

On 22/02/12 07:42, cmartin wrote:
> Hi Everyone,
>
> I am a graduate student who will be using R to do my analysis.  I need to do
> a spatial analysis, and the first step is to calculate the geographic
> distance between my study sites.  I am hoping to use earth.dist because it
> allows for multiple pairwise distances to be calculated at one time.  I have
> done a sample calculation, and I seem to have a problem between the steps of
> using create.lats and earth.dist.  I've copied the steps I've taken in R
> since I am NOT computer literate and have a real problem debugging computer
> programming.  Hopefully someone can help.
>
>
>> create.lats(weatherstations,loc="locality",long="longitude",lat="latitude")
>                     longitude latitude
> Adra                 -119.58    49.73
> Bankier Chain Lake   -120.28    49.70
> Chute Lake           -119.53    49.68
> Douglas Lake         -120.20    50.16
> Hedley               -120.08    49.36
> Hedley NP Mine       -120.02    49.37
>> data(weatherstations.lats)
> Warning message:
> In data(weatherstations.lats) : data set ‘weatherstations.lats’ not found
>> earth.dist(weatherstations.lats)
> Error in earth.dist(weatherstations.lats) :
>    object 'weatherstations.lats' not found
>> earth.dist(weatherstations)
>     1  2  3  4  5
> 2 NA
> 3 NA NA
> 4 NA NA NA
> 5 NA NA NA NA
> 6 NA NA NA NA NA
> There were 50 or more warnings (use warnings() to see the first 50)
> Thanks! Cloe



More information about the R-help mailing list