[GRASS-user] Running GRASS within R (Rstudio) on MacOS

Johannes Radinger johannesradinger at gmail.com
Thu Sep 7 04:19:33 PDT 2017


Hi Rainer,

I used following commands and got following errors and output (using
Rstudio). I also included now the output from sessionInfo() after loading
"rgrass7":

> library("rgrass7")
Loading required package: sp
Loading required package: XML
GRASS GIS interface loaded with GRASS version: (GRASS not running)
Warning message:
package ‘XML’ was built under R version 3.4.1
> #https://grasswiki.osgeo.org/wiki/R_statistics/rgrass7
>
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK:
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rgrass7_0.1-9 XML_3.98-1.9  sp_1.2-4

loaded via a namespace (and not attached):
 [1] minqa_1.2.4     MASS_7.3-47     compiler_3.4.0  Matrix_1.2-10
tools_3.4.0     Rcpp_0.12.11    splines_3.4.0
 [8] nlme_3.1-131    grid_3.4.0      nloptr_1.0.4    lme4_1.1-13
lattice_0.20-35

> # initialisation and the use of North Carolina sample dataset
> initGRASS(gisBase = "/Applications/GRASS-7.3.app", home = tempdir(),
+           gisDbase = "/Users/Johannes_Radinger/Documents/GRASS-GIS/",
+           location = "nc_spm_08_grass7", mapset = "PERMANENT",
SG="elevation",
+           override=TRUE)
sh: g.gisenv: command not found
sh: g.gisenv: command not found
sh: g.gisenv: command not found
sh: g.gisenv: command not found
sh: g.gisenv: command not found
sh: g.version: command not found
Error in system(paste("g.version", get("addEXE", envir = .GRASS_CACHE),  :
  error in running command

######

cheers,
Johannes


On Thu, Sep 7, 2017 at 11:36 AM, Rainer Krug <rainer_krug at icloud.com> wrote:

> Hi
>
> How did you run these commands from R, which error did you get?
>
> Could you provide a transcript of your errors?
>
> Rainer
>
> On 7 Sep 2017, at 10:04, Johannes Radinger <johannesradinger at gmail.com>
> wrote:
>
> Hi,
>
> I try to run GRASS73 within R (actually R-studio) using the rgrass7
> library on MacOS 10.12.6. I followed the instructions stated in the wiki (
> https://grasswiki.osgeo.org/wiki/R_statistics/rgrass7), however some of
> the commands were not working for me. For instance, "grass70 --config path"
> (also with grass73 etc) does not work here, however I found the path to the
> application which is: /Applications/GRASS-7.3.app; i.e. using
> "open /Applications/GRASS-7.3.app" opens my grass installation.
>
> So I tried to initialize GRASS (North Carolina location - PERMANENT) from
> within R using the initGRASS() command:
>
> initGRASS(gisBase = "/Applications/GRASS-7.3.app", home = tempdir(),
>           gisDbase = "/Users/Johannes_Radinger/Documents/GRASS-GIS/",
>           location = "nc_spm_08_grass7", mapset = "PERMANENT",
> SG="elevation",
>           override=TRUE)
>
> However I get following error(s):
> sh: g.gisenv: command not found
> sh: g.gisenv: command not found
> sh: g.gisenv: command not found
> sh: g.gisenv: command not found
> sh: g.gisenv: command not found
> sh: g.version: command not found
> Error in system(paste("g.version", get("addEXE", envir = .GRASS_CACHE),  :
>   error in running command
>
> So what I am doing wrong? Do I miss some arguments in my command or is
> this related to my Mac environment? Any suggestion I should try to solve
> that problem?
>
> Thanks and best regards,
> Johannes
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170907/d5dd26d3/attachment.html>


More information about the grass-user mailing list