[GRASSLIST:5697] Re: GRASS connection with R

Roger Bivand Roger.Bivand at nhh.no
Wed Feb 9 10:50:03 EST 2005


On Wed, 9 Feb 2005, Silvia Franceschi wrote:

> Thanks,
> on my pc I have GRASS 5.7 and R-2.0.1, I can not send any error because the 
> program crashes and do not write any error message.
> The other pc has GRASS 6.0 and R-2.0.1, here all seems to be right but if you 
> want to plot the results there is an error message:

OK. GRASS 5.7 and 6.0 are the answer. The R-GRASS interface works for 
GRASS <= 5.4. After GRASS 5.4, the WINDOW has been changed, meaning that 
you have to use gmeta(interp=TRUE) until some way of accommodating the 
major change in WINDOW handling in GRASS has been found that doesn't break 
the interface for <= 5.4. Please post the command you use to get the GRASS 
metadata - is it:

G <- gmeta()

Please also post summary(G).

In general I would suggest that you rather use the R gstat package, 
krige.G() is just an illustration, not a proper function:

bmd142 <- vgm(158232, "Exp", 361.6, 24803.4)
g.zinc <- gstat(formula=Zn~1, location=~east+north, data=utm.maas,
  model=bmd142)
res <- predict(g.zinc, newdata=data.frame(east=east(G), north=north(G)),
  mask=maasmask)
plot(G, res$var1.pred)

is an example using the utm.maas data set (not tried here).

Roger

> 
> > plot(G, surf.krig$zhat, col=grey(9:2/9))
>    Error in xy.coords(x, y, xlabel, ylabel, log) :
>    x and y lengths differ
> > surf.krig
> .....
> .....
> 
> $zhat
> numeric(0)
> 
> $sehat
> numeric(0)
> 
> 
> I use the data of maas and the commands to make kriging:
> - first use the log of the data
> - second make the point object
> - third make the pair object
> - fourth estimate the variogram
> - fifth fit the variogram with the gaussian and the exponential models
> - make the kriging with the comand:
> surf.krig <- krige.G(logmaas.point, "lz", logmaas.varEmod, G)
> 
> It could it be a problem of the region settings on the other pc but I don't 
> know on my pc what it could be...
> 
> Thanks Silvia
> 
> 
> > I suggest moving this question for clarification to the STATSGRASS list.
> >
> > Please state clearly which version of GRASS, which version of R and which
> > version of the interface package you are using on what platform. Saying R
> > crashed may mean that it terminated completely, but may also mean that it
> > responded correctly to your commands. Providing the commands and error
> > messages verbatim, especially with a simple, reproducible example, does
> > help a great deal. As it is, no help can be given because too little is
> > known.
> >
> > Roger
> >
> 
> 

-- 
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-user mailing list