Dear all:

I am still having trouble running R in GRASS directly. If you would be willing to provide additional suggestions, this would be greatly appreciated. 


Here is what I have so far:


1. This one is the most promising. Within the GRASS 6.4.2RC2 with MSYS, I typed using tab autocompletion: "C:/Program Files/R/R-2.14/bin/i386/Rgui.exe" which causes the RGui to pop up as a second R window. Thus, I am not in GRASS directly anymore I assume, but rather in the RGui. In this GUI, it says the following when I type library(spgrass6):
"GRASS GIS Interface loaded with GRASS version GRASS 6.4.2RC2exported (2011) and location: demolocation"
gmeta6()
gisdbase C:/Documents etc.

2. If I do "C:/Program Files/R/R-2.14/bin/i386/Rgui.exe" in the GRASS GIS Layer Manager Command console I get "WARNING unknown option'--'interface-description', and then the GRASS program crashes. 


3. I can get this to work in R directly:
loc <- initGRASS("C:/Program Files/Grass 6.4",home=tempdir())
gmeta6()
**prints gisdbase, etc.**

4. Would you be able to provide more details on these comments?

"Alternatively, you may try to add R's binary location to your PATH 
environment variable, and declare R_LIBS globally; these used to be 
under advanced system properties."
"You may also need to add R_LIBS="<whatever>" to this, to show where any local libraries may be."

Thank you for your time, consideration, and patience,
Laura



________________________________
 From: Roger Bivand <Roger.Bivand@nhh.no>

Cc: "r-sig-geo@r-project.org" <r-sig-geo@r-project.org> 
Sent: Saturday, January 14, 2012 1:03:36 AM
Subject: Re: [R-sig-Geo] Trouble with Grass 6.4.2 and R 2.14.1 interface

On Fri, 13 Jan 2012, Laura S wrote:

> Dear all:
> 
> I am trying to get R to run with grass, but I am running into trouble.
> 
> 
> This is what I have done so far:
> 
> Installed GRASS 6.4.2 for Windows XP
> Installed spgrass6 with dependencies.
> 
> When I do:
> library(spgrass6)
> gmeta6()
> 
> I get the following:
> Error in system(cmd0,intern=TRUE); "g.region.exe' not found
> Error in parseGRASS(cmd) : g.region not found.
> 
> Any suggestions are much appreciated. I am new to using GRASS with R, but I am looking forward to using them together to analyze data.
> 
> I am unsure which terminal to run R in GRASS because I keep getting errors in the command console in GRASS: I type into either "Command console in GRASS GIS Layer Manager" OR "GRASS Command Line":
> 
> R
> ...Then I get
> 
> 'R' is not recognized as an internal or external command, operable program or batch file.

This suggests that you need to give the complete path to R from within your GRASS session. It may be "C:/Program Files/R/R-2.14.1/bin/Rgui.exe" or something like that, depending on where you installed it. You may also need to add R_LIBS="<whatever>" to this, to show where any local libraries may be.

Alternatively, you may try to add R's binary location to your PATH environment variable, and declare R_LIBS globally; these used to be under advanced system properties.

Finally, as Rainer suggests, you may start GRASS from within R, using the same logic in reverse, giving the full path to the GRASS install location to the initGRASS() function. The key in both cases is to find out where in your file system the software components live, and note changes when you upgrade.

Hope this helps,

Roger

> 
> 
> Thank you
> 
> Laura
>     [[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no
	[[alternative HTML version deleted]]

