Friday's class - Spatial Analysis in R - you must install some packages before class

2 views
Skip to first unread message

Adam Wilson

unread,
Oct 8, 2008, 9:07:47 AM10/8/08
to UConn UseRs

Greetings all,

This week we'll be using a few libraries that do not come standard with R, so if you want to follow along in class you need to do the following when you have an internet connection.  One of the libraries (rgdal - http://www.gdal.org/) is a link to general library of functions that is not specific to R (ArcGIS 9.2 uses it too - but it hides it away and charges $$$ for it). For us useRs, this means it must be downloaded and installed separately (don't forget, you're playing with a powerful box of legos!).

The general steps are:
  1. Install GDAL
  2. Install R packages that depend on or are more useful with GDAL (rgdal, sp, maptools, spatstat)
Specific steps vary for windows, mac, and linux:

Linux:
Linux is the easiest.  Use YUM or equivalent to install GDAL, or compile from the source offered at http://www.gdal.org/

Windows:
Windows is pretty easy too, thanks to Frank Warmerdam.  I recommend using the FWTools package available at http://fwtools.maptools.org/ .  Download and install the binary for windows.  That collection has most of the functions and capabilities you'll need. 

Mac:
Unfortunately this looks a little more complicated for mac users - and I'm no mac expert.  It looks like the best way is to use the  'framework' from http://www.kyngchaos.com/wiki/software:frameworks.  You'll have to download and install the dependencies first (UnixImageIO, GEOS 3, SQLite3 and PROJ frameworks if you don't already have them).  Download and mount the disk images from his site and double-click the .mpkg or .pkg that's inside to install the item(s). After you've run the GDAL framework installer, add the framework to your $PATH. It should all be pointing and clicking, save for adding the framework to your path (http://forums.macrumors.com/showthread.php?t=407157).  You may also be able to install gdal through the fink package manager: http://www.finkproject.org/ but I don't know about this.  If you find a better way, please share it.  Good luck!


All OS's

After you install GDAL, you need to install the following packages either with install.packages() command or through the package manager.

spatstat, sp, rgdal, maptools


When we tested this on Jenica's computer (running vista), rgdal returned an error about a problem with the html help files, but everything works fine - so if you get that error don't worry.

To confirm that they have been installed correctly, try
library(sp)
library(rgdal)
library(spatstat)
library(maptools)

and look for any errors.

I've posted a zip file that contains Trina's data (two shapefiles and a raster) on the course website. 
http://hydrodictyon.eeb.uconn.edu/eebedia/index.php/UConn_UseRs_-_An_introduction_to_R

you'll need those files as well to follow along.  If you don't want to install all this now and would rather just come to class and see what R can do for you, that's fine too.

Adam



--
Adam Wilson
http://hydrodictyon.eeb.uconn.edu/people/wilson/
Department of Ecology and Evolutionary Biology
BioPharm 223
University of Connecticut
Tel: 860.486.4157
Adam....@UConn.edu



--
Adam Wilson
http://hydrodictyon.eeb.uconn.edu/people/wilson/
Department of Ecology and Evolutionary Biology
BioPharm 223
University of Connecticut
Tel: 860.486.4157
Adam....@UConn.edu
Reply all
Reply to author
Forward
0 new messages