<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FCarolx</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FCarolx"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FCarolx"/>
	<updated>2026-04-17T16:34:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=R_statistics/Installation&amp;diff=26900</id>
		<title>R statistics/Installation</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=R_statistics/Installation&amp;diff=26900"/>
		<updated>2023-04-21T21:32:34Z</updated>

		<summary type="html">&lt;p&gt;⚠️Carolx: /* Mac OSX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;First of all you need to install '''''R''''' in your system.&lt;br /&gt;
&lt;br /&gt;
R and many of its packages are pre-built and distributed through the CRAN network of mirrors. In addition many Linux distributions pre-package R and a number of the most popular libraries.&lt;br /&gt;
&lt;br /&gt;
=== Status of rgrass package ===&lt;br /&gt;
&lt;br /&gt;
See the overview here: https://cran.r-project.org/web/packages/rgrass/index.html&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
&lt;br /&gt;
===== Debian and Ubuntu =====&lt;br /&gt;
&lt;br /&gt;
''R'' and a number of pre-build cran packages are already present in the main repositories. Start with:&lt;br /&gt;
&lt;br /&gt;
 # apt-get install r-base r-cran-vr r-cran-rodbc r-cran-xml&lt;br /&gt;
&lt;br /&gt;
Once those are installed start &amp;quot;&amp;lt;tt&amp;gt;R&amp;lt;/tt&amp;gt;&amp;quot; at the command prompt and install the &amp;lt;tt&amp;gt;rgrass&amp;lt;/tt&amp;gt; library:&lt;br /&gt;
&lt;br /&gt;
 install.packages(&amp;quot;rgrass&amp;quot;, dependencies = TRUE)&lt;br /&gt;
&lt;br /&gt;
* [https://cran.r-project.org/bin/linux/debian/ Debian] and [https://cran.r-project.org/bin/linux/ubuntu/ Ubuntu] specific help is also available from the R-project website.&lt;br /&gt;
&lt;br /&gt;
===== RPM based =====&lt;br /&gt;
&lt;br /&gt;
* '''RedHat, Fedora, openSuse, ...''' and similar distros: &lt;br /&gt;
&lt;br /&gt;
 # sudo dnf install R&lt;br /&gt;
&lt;br /&gt;
This R RPM is a meta-package. It has no content but ensures that the following components are installed: R-core, R-core-devel, R-java, R-java-devel, libRmath, libRmath-devel. Once those are installed, start &amp;quot;&amp;lt;tt&amp;gt;R&amp;lt;/tt&amp;gt;&amp;quot; and install the &amp;lt;tt&amp;gt;rgrass&amp;lt;/tt&amp;gt; library:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
install.packages(&amp;quot;rgrass&amp;quot;, dependencies = TRUE)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mac OSX ====&lt;br /&gt;
&lt;br /&gt;
Start an R session and try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
install.packages(&amp;quot;rgrass&amp;quot;, type=&amp;quot;source&amp;quot;, dependencies = TRUE)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Startup of GRASS from within R:'''&lt;br /&gt;
&lt;br /&gt;
First you need to find the path to the GRASS binaries: Control-click on the GRASS.app and you'll get a popup menu; select &amp;quot;Show Package Contents&amp;quot; - this opens you to the directory structure. Go to Contents-&amp;gt;Resources which would be &amp;quot;GISBASE&amp;quot;; So, in my case, the &amp;quot;gisBase&amp;quot; parameter is &amp;quot;/HD/Applications/Grass-8.2.app/Contents/Resources&amp;quot;. If you Command-click at the top of the window on the folder icon beside &amp;quot;Resources&amp;quot; (from the line above this one), you can see the full path.&lt;br /&gt;
&lt;br /&gt;
Now we can run GRASS from within a R session:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
library(rgrass)&lt;br /&gt;
initGRASS(gisBase ='/Applications/GRASS-8.2.app/Contents/Resources', &lt;br /&gt;
          location = 'nc_spm_08_grass7', &lt;br /&gt;
          mapset = 'user1', &lt;br /&gt;
          gisDbase = '/Users/carol/Documents/grassdata', &lt;br /&gt;
          override = TRUE)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Troubleshooting =====&lt;br /&gt;
&lt;br /&gt;
If you get an error message when trying to call GRASS from R containing this line: dyld: Library not loaded: /usr/local/lib/libintl.8.dylib you need to establish a link from /Applications/Grass/GRASS-8.2.app/Contents/MacOS/lib/libintl.8.dylib to /usr/local/lib. This can be done through Terminal with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /Applications/Grass/GRASS-8.2.app/Contents/MacOS/lib/libintl.8.dylib /usr/local/lib/&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note''': The path to the GRASS-x.x.app and the version number in libintl.X.dylib must reflect your own configuration.&lt;br /&gt;
&lt;br /&gt;
==== MS Windows ====&lt;br /&gt;
&lt;br /&gt;
===== Installation =====&lt;br /&gt;
Run:&lt;br /&gt;
 install.packages(&amp;quot;rgrass&amp;quot;, dependencies = TRUE)&lt;br /&gt;
&lt;br /&gt;
or install Task View 'Spatial' - Analysis of Spatial Data&lt;br /&gt;
 install.packages(&amp;quot;ctv&amp;quot;)&lt;br /&gt;
 library(ctv)&lt;br /&gt;
 install.views(&amp;quot;Spatial&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===== Usage =====&lt;br /&gt;
&lt;br /&gt;
In winGRASS ([https://grass.osgeo.org/download/windows/#standalone-installers standalone installer] and [https://grass.osgeo.org/download/windows/#OSGeo4W OSGeo4W]) the installation path of R and RStudio are dynamically loaded into PATH.&lt;br /&gt;
&lt;br /&gt;
* Start winGRASS, bring the winGRASS-windows console in front and type ''R'' for opening an R session (command line mode) inside a GRASS session.&lt;br /&gt;
* Start winGRASS, bring the winGRASS-windows console in front and type ''RGui'' for opening an R session (GUI mode) inside a GRASS session.&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Linking to other languages]]&lt;br /&gt;
[[Category:R]]&lt;br /&gt;
[[Category:Statistics]]&lt;/div&gt;</summary>
		<author><name>⚠️Carolx</name></author>
	</entry>
</feed>