Skip to content

GRASS with R interface issues - running R within GRASS 6.4.2

4 messages · Laura S, Roger Bivand

#
On Mon, 23 Apr 2012, Laura S wrote:

            
Please do try to search more effectively. The standard way of running R 
inside GRASS on Windows is to start GRASS first in the location you are 
using, then enter the complete path to R at the MSYS prompt. The complete 
path is the same as the string shown as Target: under Properties if you 
right-click on the R icon on your Windows desktop. For example:

"C:/Program Files/R/R-2.15.0/bin/i386/Rgui.exe"

or the equivalent for your installation. You may also need to set the 
environment variable R_LIBS if R cannot "find" the correct library 
containing the packages you need.

If you are not using a GRASS location, you may use the initGRASS() 
function in spgrass6 to start a temporary GRASS session, often in a 
throw-away location, because you only need to move objects from R to 
GRASS, use GRASS on them, and move the output objects back to R. Then you 
need the complete path to the GRASS install directory, for example:

"C:/Program Files/GRASS 6.4.2"

or the equivalent for your installation.

It is also possible to use initGRASS() with existing locations in a 
scripting context, but this is not your case.

The grass-stats mailing list is often used for questions like this.

Hope this clarifies,

Roger

  
    
#
On Mon, 23 Apr 2012, Laura S wrote:

            
Why should it? Simply minimise the R GUI to work in GRASS directly, using 
the GRASS GUI or from the prompt in MSYS. I doubt very much whether saying 
d.ask makes sense anyway, as the GRASS display GUI covers that.

It is possible to write GRASS commands using execGRASS() from the R 
console, but since you have had to ask, you will find it easier simply to 
minimise R and use GRASS directly. Because R is within GRASS, it "sees" 
the current status of the location.

Hope this clarifies - please change to one of the GRASS lists for further 
help.

Roger