[STATSGRASS] sites import problem
Roger Bivand
Roger.Bivand at nhh.no
Mon Mar 17 10:01:14 EST 2003
On Mon, 17 Mar 2003, Roger Bivand wrote:
> On Mon, 17 Mar 2003, javier garcia - CEBAS wrote:
>
> > Hi;
> > I've imported a sites file into R, but get the following warning messages:
> > ------------------------------------------------------------------------------------------------------
> > > Cotas <- sites.get(G, slist="cotas_5000", debug=FALSE)
> > > ls()
> > [1] "Cotas" "G" "system"
> > > summary(Cotas)
> > east north var1
> > Min. :632206 Min. :4163710 Min. : 0.00
> > 1st Qu.:657634 1st Qu.:4174570 1st Qu.: 65.13
> > Median :666414 Median :4179580 Median : 140.00
> > Mean : NA Mean : NA Mean : 161.71
> > 3rd Qu.:676889 3rd Qu.:4184840 3rd Qu.: 240.00
> > Max. :688899 Max. :4198600 Max. :1116.18
> > Warning messages:
> > 1: Integer overflow in sum(.); use sum(as.numeric(.))
> > 2: Integer overflow in sum(.); use sum(as.numeric(.))
> > ---------------------------------------------------------------------------------------------
> > I can't understand the consecuences of this warning nor how to avoid it
> > Any help?
>
> Which version of R, and the interface package are you using - it always
> helps to know?
In the current version (0.2-6 on CRAN, 0.2-7 on
html://spatial.nhh.no/R/GRASS/), the compiled sites.get() function used
doubles for coordinates. I think you are using a version earlier than
0.2-1, with the interpreted function, in which you get the representation
seen by scan() in the temporary text file used for transfer. as.double()
should fix your immediate problem, but updating to the compiled interface
may be a better solution.
Roger
>
> If there are many points, then the sums of the coordinates may exceed
> INT_MAX=2147483647 in calculating the means. The warning means that if you
> need the mean of for example Cotas$east, which is represented as an
> integer, you could do summary(as.double(Cotas$east)), which will run.
>
> For integer northings you run out of integers (at 4000km N of the equator)
> after 540 points, for your eastings you run out at about 3600 points.
> Another way to do this is to divide the coordinates by 1000 to represent
> values as km.
>
> I'll look at why sites.get() is returning integers, when it should
> probably be returning doubles.
>
> Roger
>
> >
> > Javier
> >
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the grass-stats
mailing list