[R] corspatial

Kingsford Jones kingsfordjones at gmail.com
Fri Jul 10 04:09:36 CEST 2009


On Thu, Jul 9, 2009 at 6:12 PM, Kitty Lee<lee.kitty at yahoo.com> wrote:
>
> Hi. I have a dataset of unique coordinates (no missing coordinates). When I did the following:
>
> lonlat<-mydata[, c("lon, "lat")]
> sp1<-corSpatial(1,form=~lon+lat,type="g")
> scor<-Initialize(sp1, lonlat , nugget=FALSE)
>
> I got a value for sp1 (2.67). But got an error message for scor--Error in getCovariate.corSpatial(object, data = data) :
>  Cannot have zero distances in "corSpatial"
>
> I find that puzzling since I have unique coordinates and there should not be any zero distances. Any idea?

The error does suggest the function thinks there are duplicates in
lonlat.  Have you tried, for example, sum(duplicated(lonlat))?  Or you
could add a small amount of random noise to one of the coordinates and
then see if Initialize will run...


hth,
Kingsford Jones

>
> Thanks!
>
> K.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list