[GRASS-stats] "g.region: command not found" using readRAST6 command

Daniel McInerney daniel.mcinerney at ucd.ie
Wed Oct 7 07:06:03 EDT 2009


Hi Tim,
You should run R from within the GRASS shell
environment.  So launch a terminal and run GRASS,
select a GRASS location and mapset, and then from
within the GRASS shell, run R. You should then be able
to read/write GRASS rasters from R.

Regards,
Daniel.

Tim Holland wrote:
> Hi Daniel,
>
> No, as it was I was trying to run things through R.  Grass was (is) 
> running, but just incidentally.  Your comment made me think I needed 
> to run initGRASS() first, so I tried, but got the following:
>
> > initGRASS(gisBase="/Library/GRASS/6.4", 
> gisDbase="/Users/timholland/Documents/GIS/Vietnam_General/VN_GrassDbase")
> Error in initGRASS(gisBase = "/Library/GRASS/6.4", gisDbase = 
> "/Users/timholland/Documents/GIS/Vietnam_General/VN_GrassDbase") :
>   A GISRC file already exists; to override, set override=TRUE
>
> Should I be running R through GRASS?  (as opposed to vice-versa, as 
> had been my understanding).  If so, how do I do that? 
>
> Again, sorry for really basic questions, but thank you for the help.
>
> Best,
> Tim
>
>
>
> On Wed, Oct 7, 2009 at 3:52 PM, Daniel McInerney 
> <daniel.mcinerney at ucd.ie <mailto:daniel.mcinerney at ucd.ie>> wrote:
>
>     Hi Tim,
>     Is R running within a GRASS session?
>
>     Regards,
>     Daniel.
>
>     Tim Holland wrote:
>
>         Hello,
>         I'm sorry to keep making so much noise on the list for what
>         I'm sure are
>         basic questions.  
>         I am having trouble loading in a GRASS raster into R using the
>         readRAST6
>         command.  
>         Using:  
>
>             readRAST6("rasterMap",mapset="/Users/etc/my_mapset")
>                
>
>
>         I get the following error:
>          
>
>             Error in if (file.exists(file) == FALSE) if
>             (!missing(asText) && asText ==    
>
>         :  argument is of length zero
>          
>
>             Error in parseGRASS(cmd) : g.region not parsed
>             sh: g.region: command not found
>                
>
>
>         Is there something I am doing wrong here?  
>         Also, when I am working with spgrass6 in general, should I
>         have my working
>         directory set to the GRASS DBase I am using, or does that
>         matter?  
>         Thank you for the help, Tim
>
>
>          
>
>             sessionInfo()
>                
>
>         R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1
>         locale:
>         en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
>         attached base packages:
>         [1] stats     graphics  grDevices utils     datasets  methods
>           base    
>         other attached packages:
>         [1] spgrass6_0.6-9 XML_2.6-0      rgdal_0.6-12   sp_0.9-44    
>         loaded via a namespace (and not attached):
>         [1] grid_2.9.2      lattice_0.17-25
>
>
>          
>
>
>



More information about the grass-stats mailing list