Navigation

Entries in R (1)

Tuesday
Jun192012

Notes from A Recent Spatial R Class I Gave

Below is a link to a pdf (compiled with the amazing knitr package) and some accompanying data for a recent short course I gave on basic spatial data import/analysis/visualization in R. The class was only two hours and some of the participants were being exposed to R for the first time so the material is limited. The class was a follow up to a previous one I did on ArcGIS. The idea was to show how to perform the same functions in R and ArcGIS and then let users decide which worked best for them (I use R for about 90% of my spatial analysis and data handling but find ArcGIS (or some GUI based GIS) pretty essential for that last 10%). 

The content/main points of the course:

  • Basic intro to R
  • Reading in a Shapefile
  • Doing a table join with a shapefile and a data.frame
  • Generating random points
  • Doing a point in polygon spatial join
  • Reading and cropping raster data
  • Doing a pixel in polygon spatial join (using extract() from the raster pacakge)
  • Plotting and annotating a shapefile in ggplot2
  • Making panel maps in ggplot2

The notes contain all the R-code and a lot of grammatical and spelling errors. I hope to improve and update this class over time. Please let me know if:

  1. You find the material useful
  2. You use it/modify for a class of your own (and please share the results)
  3. You have any major suggestions for improvements (I'm aware of most of the minor issues)