The rgeos package contains functions to union polygons together (amongst others), and is a dependent (i.e. required) package for T-LoCoH. rdgal is a suggested package, because it contains functions for importing GIS data (which can be displayed in plots).
If you are using OS X Mavericks or later, there may not be binary versions of rgeos or rdgal on CRAN. This means you have to install the geos and gdal libraries separately (free), and then install the rgeos and rgdal R packages (from source). The steps below describe that process in more detail.
These instructions were adapted from Lost in Geospace.
Problems installing geos? You can also install geos using MacPorts, which is a Mac utility you can download that allows you to install open source software using a command line (in Terminal). MacPorts example.
You've now installed geos. If fortune is smiling on you, you may just be able to install rgeos by typing in R:
install.packages("rgeos", repos="http://R-Forge.R-project.org", type="source") require(rgeos)
If that worked, then you're done. But, if you get an error message, the next thing to try is to install rgeos from the command line.
R CMD INSTALL /path-to-rgeos/rgeos_version.tar.gz --configure-args='--with-geos-config=/Library/Frameworks/GEOS.framework/unix/bin/geos-config'
If it worked, you should see some compiling going on, ending with:
** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded * DONE (rgeos)
See if it worked by typing into R:
require(rgeos)
The steps for installing gdal and rgdal are very similar to the ones above. Remember that rgdal is only needed if you plan on displaying GIS files in your plots.
Problems installing gdal? You can also install gdal using MacPorts, which is a Mac utility you can download that allows you to install open source software using a command line (in Terminal). MacPorts example.
install.packages("rgdal", repos="http://R-Forge.R-project.org", type="source") require(rgdal)
R CMD INSTALL /path-to-downloads/rgdal_0.9-1.tar.gz --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/Programs/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/Headers --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib'
If installing from source didn't work, some nice person at the University of Oxford has created Mac binaries for rgeos and rgdal. Note though these may not by the most recent versions of the packages, and they may or may not work with the most recent version of R.
install.packages('rgeos',repos="http://www.stats.ox.ac.uk/pub/RWin") install.packages('rgdal',repos="http://www.stats.ox.ac.uk/pub/RWin")
Questions? Comments? Alternative solutions? Please email the package author.