[R-sig-Geo] interfacing GRASS and R with spgrass6

Roger Bivand Roger.Bivand at nhh.no
Tue Oct 15 13:48:33 CEST 2013


On Tue, 15 Oct 2013, Milan Cisty wrote:

> Dear list members.
>
> I am trying to interface GRASS and R with spgras6. I am on Windows 7 64 bit,
> and I have R 3.02, GRASS 6.4 and I am running things from RStudio.

Repeat this outside R Studio. R Studio interposes things between R and its 
environment without checking the consequences adequately. If the problem 
persists, remove all GRASS environment variables from your working 
environment.

Consider posting on the statgrass list, which is the correct list for this 
kind of question.

There is no reason why spgrass6 should not load successfully, unless 
Sys.getenv("GISRC") returns an erroneous string, or the correct string but 
other GRASS environment variables are not set correctly (never set them 
yourself unless you are quite sure you understand). If you are not running 
R "inside" GRASS - see the documentation in the package:

system(paste(options("pdfviewer"),
  system.file("doc/OSGeo_vol1_GRASS-R.pdf", package="spgrass6")))
system(paste(options("pdfviewer"), system.file("doc/spgrass6_0.3.pdf",
  package="spgrass6")))

(untried). If you set GISRC but are not running R inside GRASS, expect 
trouble.

Roger

>
> I installed spgrass6, but when I am loading it, I get this message:
>
>> library("spgrass6", lib.loc="C:/Program Files/R/R-3.0.2/library")
>
> Loading required package: sp
>
> Loading required package: XML
>
> Error : .onAttach failed in attachNamespace() for 'spgrass6', details:
>
>  call: system(paste("g.version", get("addEXE", envir = .GRASS_CACHE),
>
>  error: 'g.version.exe' not found
>
> Error: package or namespace load failed for 'spgrass6'
>
>
>
> I googled a little, and I set some environmental variables on my comuter
> according one www:
>
> GISBASE to C:\GRASS64   (where I have it)
>
> GISRC to C:\Users\Cisty\AppData\Roaming\GRASS6  (where I have file grassrc6.
> In my Windows it is grassrc6, not .grassrc6)
>
> And I added to path variable this two paths: C:\GRASS64\bin;
> C:\GRASS64\scripts;
>
>
>
> One thing - on GRASS download page I read that i tis for 64 and 32 bit
> systems, but during instalation it never asks, if I want to instal 64-bit or
> 32-bit version of GRASS, so I am not sure which version I have. All other
> software I have for 64-bit architecture. Because of this I tryed to load
> spgrass6 also from pure 32 bit R 3.02, but it produced exactly the same
> error. I do not know if spgrass6 needs to be reinstaled for using in 32-bit
> R.
>
> Thanks for any advice,
>
> Milan
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at 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 at nhh.no



More information about the R-sig-Geo mailing list