Fwd: [GRASS-user] Spgrass6 and R using GRASS Bash Scripts

Gilbert Ferrara gilbertferrara1974 at gmail.com
Thu Apr 22 04:32:51 EDT 2010


Greetings
Thanks Markus and Milton for your help But...
Imagine that I'm running a GRASS Script with Module, and all GRASS
functions. How can I integrate it in there? I mean, the user selects a
raster and How can i use that input to run a Script that calls R? That is my
question. Because I can have a script, like you sent me, but it's not
interactive...
Or is it easier using Python?


On Fri, Apr 16, 2010 at 3:28 PM, Markus Neteler <neteler at osgeo.org> wrote:

> On Fri, Apr 16, 2010 at 11:21 AM, Gilbert Ferrara
> <gilbertferrara1974 at gmail.com> wrote:
> > Good Morning
> > I need to do something similar to what Neteler/Mitasova do in their book
> > with spgrass6 and R. Since I will have to perform this a couple of times
> I
> > want to build a simple Script with input/output GUI. But I have never
> seen a
> > GRASS Bash script that calls R and spgrass6. So my question is? Does
> anyone
> > have/knows one? If not, I just need to send to the command line exacly
> the
> > same commands? e.g. R , summary(data) )
>
> Yes. Example:
>
> GRASS 6.4.0svn (nc_spm_08):~ > cat R_batch_nc.R
> library(spgrass6)
> mydem <- readRAST6("elevation")
> summary(mydem)
>
> To run it inside GRASS, do
>
> GRASS 6.4.0svn (nc_spm_08):~ > R CMD BATCH R_batch_nc.R
>
> The standard output result is stored in R_batch_nc.Rout. Of course
> you can also generate new GIS data in R and write them back to
> GRASS with writeRAST6() or writeVECT6().
>
> Hope this helps,
> Markus
>
> PS: Yes, I am also suprised that the GRASS Wiki isn't full of
> useful scripts calling R in GRASS in batch mode...
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100422/6f2f8722/attachment.html


More information about the grass-user mailing list