Author: Interface functions by Roger Bivand
Description: Interface between GRASS geographical information system and R,
based on starting R from within the GRASS environment and chosen
LOCATION and MAPSET. Wrapper and helper functions are provided for
a range of R functions to match the interface metadata structures.
As an interesting option, ESS (emacs speaks statistics user interface)
works both on UN*X based and MS-windows based systems.
From version 0.2-3, the regular R package install mechanisms will work,
including the online installation of the source package under
Linux/Unix:
For MS-Windows binary online installation, either download GRASS.zip
from http://spatial.nhh.no/R/GRASS/,
or wait for Prof. Brian Ripley's build train to make the package available on
CRAN.
The notes below refer to manual installation and linking with GRASS
libraries in versions up to and including 0.2-1.
Installation of the interface:
> install.packages("GRASS")
Older versions: Installation of GRASS/R interface versions < 0.2-3
A) Installation on UN*X compilant systems (Linux etc)
There are a number of configure flags that may be used to help
the R install script find the GRASS libraries: they are
--configure-args=--grass5= (full path to your grass5 script)
--configure-args=--gmake5= (full path to your gmake5 script)
--configure-args=--zinclude= (full path to directory with zlib.h)
--configure-args=--zlib= (full path to directory with libz.a)
--configure-args=--interp (don't build compiled interface)
When GRASS lives in the standard /usr/local/grass5/ directory,
installation is simply done with:
/usr/bin/R CMD INSTALL -c GRASS_version.tar.gz
(adjust the path to R and the version number of the interface)
If you have installed GRASS in another directory, you should specify
the "grass5" startup script directly during installation (example):
/usr/bin/R CMD INSTALL --configure-args=--grass5=/usr/local/bin/grass5 GRASS_0.1-9.tar.gz
UNINSTALLATION on UN*X compilant SYSTEMS (Linux etc)
The following command uninstalls the GRASS/R interface (GRASS remains
untouched of course):
/usr/bin/R CMD REMOVE GRASS
B) Installation on MS-Windows systems (XP, 2000 etc)
- use either 'winGRASS with generic display driver' (no Xserver needed) or 'winGRASS with XServer support'
- R for MS-Windows - see install hints
- GRASS/R interface from Roger Bivand (it is running both under UN*X and MS-Windows)
- Installing R contribution packages requires that Perl 5.005 or later be installed.
(e.g. ActivePerl)
In general winGRASS under Cygwin is able to talk to R/MS-Windows (R/Windows FAQ)
Currently ActivePerl seems to be the better choice for the installation.
R/Windows Installation hints
Preparation:
- You have to add c:\Perl\bin in the PATH variable of Windows (CHECK: really needed?)
- To bypass Cygwin's path and make sure that MinGW and Perl are the first
directories in the Cygwin path. So, one needs to modify the /etc/profile
file AND any user defined resource file in their home directory
(i.e. a ~/.bash_profile that needed updating too - don't know why but it
does). If ~/.bash_profile is not present, make it a copy of /etc/profile.
In /etc/profile change the PATH= definition so that $PATH comes first
(per default it comes last). Something like
PATH="$PATH:/usr....."
- rw1060\bin - that can be put in the path too (or rw1062\bin or ...)
- When you installed R from rw1060.exe, you should have accepted the default
install of source package installation files too.
Then, installation of the GRASS/R interface (note, no 'CMD'!):
- Rcmd.exe INSTALL -c GRASS_version.tar.gz
Or, for the compiled version:
- Rcmd.exe INSTALL --configure-args=--grass5=/usr/local/bin/grass5 GRASS_0.1-9.tar.gz
NOTE 1: When using the GRASS/R interface, ignore (if appearing) strange error messages
which are generated by the GRASS/R interface.
NOTE 2: If the temp directory contains spaces, R has a problem (see
tempfile() help page). You have to change the R temp dir (ADD how to
do that?)
NOTE 3: We also succeeded to run R in GRASS on Cygwin in batch mode.
(You are kindly invited to improve this page as send it to us)