[GRASS-user] Using RStudio in a GRASS GIS session

Roger Bivand Roger.Bivand at nhh.no
Sat Apr 20 05:43:27 PDT 2024


Enter:

library(rgrass)

at the R prompt in rstudio, not at the GRASS console prompt; it is an R command.

The error message:

Der Befehl "library" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

comes from Windows, not GRASS or R.

---
Roger Bivand
Emeritus Professor
Department of Economics
Norwegian School of Economics, Bergen, Norway

________________________________
Fra: sibylle.stoeckli at gmx.ch <sibylle.stoeckli at gmx.ch>
Sendt: lørdag, april 20, 2024 1:10:29 p.m.
Til: Roger Bivand <Roger.Bivand at nhh.no>
Kopi: grass-user at lists.osgeo.org <grass-user at lists.osgeo.org>
Emne: RE: [GRASS-user] Using RStudio in a GRASS GIS session

Dear Roger
Dear community


May aim is to use RStudio in a GRASS GIS session, to visualize raster and vector data: e.g. a boxplot of a species raster file or boxplot of a species raster file differentiated for different regions (vector file).
Similar in
https://ecodiv.earth/post/drawing-boxplots-of-raster-values/

Because of my name with “ö” I changed the location to C:/GrassGIS: this seems to be the solution for the error when staring GRASS. No warming anymore.
[cid:image002.png at 01DA9324.1BBB33D0]



Using the command line, I was able to produce a boxplot.
[cid:image001.png at 01DA9321.A9F85900]

I am more comfortable in R, so I tried starting R inside the GRASS console (as suggested for windows) following the code here:
https://rsbivand.github.io/rgrass/articles/use.html
However, I am still struggling around with the error

The command "library" is either misspelled or

could not be found.

library(rgrass)
Der Befehl "library" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
(Sat Apr 20 12:57:24 2024) Command ended with non-zero return code 1 (0 sec)


Kind regards
Sibylle

From: Roger Bivand <Roger.Bivand at nhh.no>
Sent: Saturday, April 20, 2024 8:09 AM
To: sibylle.stoeckli at gmx.ch
Cc: grass-user at lists.osgeo.org
Subject: Re: [GRASS-user] Using RStudio in a GRASS GIS session

First tell us exactly what you do. Do you start GRASS first (how was GRASS installed, which version?), then what? The first message suggests a failed GRASS installation. Can you use GRASS at all? Try to run any regular example on the data in your location in GRASS to check that GRASS works before anything else.

---
Roger Bivand
Emeritus Professor
Department of Economics
Norwegian School of Economics, Bergen, Norway

________________________________
Fra: sibylle.stoeckli at gmx.ch<mailto:sibylle.stoeckli at gmx.ch> <sibylle.stoeckli at gmx.ch<mailto:sibylle.stoeckli at gmx.ch>>
Sendt: fredag, april 19, 2024 5:56:04 p.m.
Til: Roger Bivand <Roger.Bivand at nhh.no<mailto:Roger.Bivand at nhh.no>>
Kopi: grass-user at lists.osgeo.org<mailto:grass-user at lists.osgeo.org> <grass-user at lists.osgeo.org<mailto:grass-user at lists.osgeo.org>>
Emne: RE: [GRASS-user] Using RStudio in a GRASS GIS session


Dear community
Dear Roger

I suppose it is my name
Here the output from the console:

C:\Users\Sibylle Stöckli>
C:\Users\Sibylle Stöckli>
ERROR: Unable to read WIND file: not enough values to unpack (expected 2,
got 1)
library(rgrass)
Der Befehl "library" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

Kind regards
Sibylle

-----Original Message-----
From: Roger Bivand <Roger.Bivand at nhh.no<mailto:Roger.Bivand at nhh.no>>
Sent: Friday, April 19, 2024 4:31 PM
To: sibylle.stoeckli at gmx.ch<mailto:sibylle.stoeckli at gmx.ch>
Cc: grass-user at lists.osgeo.org<mailto:grass-user at lists.osgeo.org>
Subject: Re: [GRASS-user] Using RStudio in a GRASS GIS session

Please see: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Frsbivand.github.io%2Frgrass%2Farticles%2Fuse.html&data=05%7C02%7CRoger.Bivand%40nhh.no%7C04d6d2c547b14550ec5f08dc608936de%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638491389645818206%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=3fLYSzCE3uRNBetqb69RxZz%2FzLiv%2F1LuBFkdb%2B19nsA%3D&reserved=0<https://rsbivand.github.io/rgrass/articles/use.html>.
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Frsbivand.github.io%2Frgrass%2Farticles%2Fuse.html&data=05%7C02%7CRoger.Bivand%40nhh.no%7C04d6d2c547b14550ec5f08dc608936de%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638491389645826443%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=zM%2Fia4%2BGNTgKd%2Bjxo3HVJnDgt02JrI9CSyx%2F1AtwK%2FU%3D&reserved=0<https://rsbivand.github.io/rgrass/articles/use.html>

Do you have a GRASS location and wish to use R on the data in that location?
Then start GRASS first and start rstudio from inside GRASS.

The error messages suggest that something is missing in your installation.

Is your query related to
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fpipermail%2Fr-help%2F2024-April%2F479232.html&data=05%7C02%7CRoger.Bivand%40nhh.no%7C04d6d2c547b14550ec5f08dc608936de%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638491389645832105%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=i1bTT5y7lmJcG1MtEniurDJsEYbK63t0UB%2BSagiLmMM%3D&reserved=0<https://stat.ethz.ch/pipermail/r-help/2024-April/479232.html> ?

--
Roger Bivand
Emeritus Professor
Norwegian School of Economics
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway Roger.Bivand at nhh.no<mailto:Roger.Bivand at nhh.no>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20240420/2d657b40/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 236187 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20240420/2d657b40/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 34891 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20240420/2d657b40/attachment-0003.png>


More information about the grass-user mailing list