[STATSGRASS] Fwd: R-GRASS question

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 6 15:04:32 EST 2003


On Thu, 6 Nov 2003, javier garcia - CEBAS wrote:

> Hi all;
> 
> I also asked this question directly to Roger Bivand, but perhaps anyone else 
> know the answer:
> 
> Do you have an example, or know about someone who has, about how to generate
> maps in R and export them into GRASS?
> 
> I mean: I would like to create GRASS maps in R, considering the actual region
> of GRASS, but in the source for these new maps is not any GRASS imported
> maps; it could be, for example, a random field, or whatever. And I would like
> that these maps could take the class of GRASS imported maps, so I could, for
> example, overlay them on the GRASS maps in R, or exported them to GRASS.
> 
> I guess this could be done in someway. But how?

Perhaps others could add examples, but many of the wrapper functions in 
the interface package were put there to encourage people to use R 
functions interpolating or predicting surfaces, and then move them to 
GRASS. if you look at the list of functions, then interp.new.G(), 
kde2d.G(), and trmat.G() are like this. I would not use krige.G() any 
more, prefering predict.Krig() from the fields package or predict.gstat() 
from gstat. It's worth looking at some of the others too, predict.loess() 
in modreg(), or predict.gam() in mgcv, if the x,y coordinates were among 
the RHS fitting variables, and you have newdata on a grid for the other 
RHS variables if any. 

The grasper package does this very nicely for GAMs, including writing the
predicted values to GRASS through the interface (according to the
documentation). So maybe the problem is too much choice than too little?
Has anyone used predict.rpart() from rpart in this context? Essentially
anything that has a generic predict() function, and where the newdata
argument can be structured in the same order as the GRASS raster data is a
candidate for making new layers.

I haven't done this with the RandomFields package, but it looks as though 

GaussRF(x=east(G), y=north(G), grid=FALSE, model= ..., n=1, ...

would give you a simulated RF, but what you choose will depend on what you 
need.

(Sometimes, I'm not online, so asking the list first may get you a quicker 
reply)

Roger

> 
> Could you help me with this?
> 
> Thanks all and best regards
> 
> Javier
> 
> 
> --
> A. Javier Garcia
> Water and Soil Conservation Department
> CEBAS-CSIC
> Campus Universitario de Espinardo
> Apartado 4195
> 30100 Murcia (Spain)
> Phone: +34 968 39 62 57
> Fax: +34 968 39 62 13
> email: rn001 at cebas.csic.es
> 
> -------------------------------------------------------
> 
> _______________________________________________
> statsgrass mailing list
> statsgrass at grass.itc.it
> http://grass.itc.it/mailman/listinfo/statsgrass
> 

-- 
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