-3

I was trying to write a shell script using GRASS commands and I realized that I wanted to use R commands in my code but I couldn't find a way to execute the Rscript using my results from the GRASS commands, without using import/export commands. Is there a way to pass the results of my GRASS commands to my Rscript or execute R commands in the same script without using import/export commands? Meaning that I want to take an ndvi raster that I have calculated from GRASS GIS commands and print out some statistics using R commands.

P.S I hope I was clear enough and helped you understand my problem.

  • Please do not use the scripting tag because we are in the process of burninating it. Using R indicates that you are scripting. gis.meta.stackexchange.com/questions/4648/… – PolyGeo Aug 22 '17 at 0:34
  • This is a bit unclear. You want to run a shell and run R from that shell prompt and then run GRASS from that R prompt? What's an "executable shell", because I don't think there's such a thing as a "non-executable shell". – Spacedman Aug 22 '17 at 9:42
  • @Spacedman No-no. I wanted to write a shellscript that both executes R and GRASS commands and after a long way of wrong answers I found a way to do so and I wanted to share it with the gis stackexchange community because I have passed through a lot of posts that want to either start GRASS GIS from R or they want to do a statistical analysis and they don't know where to start. I am not acting on behalf of them, I am just sharing my knowledge. – George Nostradamos Aug 22 '17 at 11:50
-2

There are libraries in R, really similar to the ones that PYTHON has, that can run GRASS code. Now if you are new and you want to start a shell script !/bin/sh you should install first the rgrass7 library in R and you will need an older version of R to pull rasters from GRASS, given that you are having the usual;

Warning in install.packages : package ‘Χ’ is not available (for R version x.y.z)

and from there you can add parallel programing, maps or whatever else you want.

  • 1
    Could you include a sample script or R code or something here to make it clear what you've actually answered? – Spacedman Aug 22 '17 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.