I am using rgrass7 with R and by typing the following

initGRASS(gisBase = "C:/GRASS/GRASS_GIS_7_3_svn", 
home=tempdir(), gisDbase = "C:/Users/main/Desktop/data",
location = "Thesis",mapset = "user", override = T)

I get this error

Error in if (get("SYS", envir = .GRASS_CACHE) == "WinNat" && nchar(WN_bat) == : missing value where TRUE/FALSE needed

Now I was wandering if anyone else had the same problem at some point and knows how to prevent it.


I have spent 3 hours trying to solve this weird issue. Initiating the exact same GRASS session that was working the day before, then I closed RStudio, and next time it was simply not working.

I found the issue has something to do with not finding/reading the GRASS_CACHE in the system environment path. Checked the windows path and it was not the issue.

I just restarted the computer and it was just fixed. I guess it has something to do with adding/removing the existing grass cache form the memory.

  • Yeah, turns out that GRASS doesn't like R. Meaning that every time you have to work with R and GRASS you have to make sure that the cache is clear, or that you should restart your PC. That is a problem with the library because parsing commands from GRASS in R is rather confusing for R but executing Rscript in GRASS is easier. – George Nostradamos Mar 10 '18 at 15:35
  • Restarting R session within RStudio helps too. – Vladimir Jun 26 '18 at 8:04

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.