GIS and Mapping with R

Richard Condit -- Morton Arboretum -- Fall 2017

Overview
Content
Function list
Assignments
R code
Command history
Sample Data

The course will cover mapping and spatial analyses using R. Most of the features of Arcgis or other GIS software are available in R: some are missing, but R also opens more possibilities by making full data accessible. The main topics will be the use of shape files and raster maps, including the creation of maps as well as spatial analyses.

The class will start with a two-week review of basic R. Participants who have reasonable experience with R might decide to skip these. These will cover data types in R, use of dataframes, and basic graphing functions in base R and how they are used for creating maps.

During each session, I will explain methods and present examples of their use, then students will work on assignments using these methods. Datasets will be provided, but students are encouraged to bring their own geographic data as well. A course web site will provide sample code, data, and a list of key R functions.

Students should

Schedule

Software required

Web site at http://richardcondit.org/workshops/Rgis/MortonArboretum including:

Each will be updated regularly throughout the course.


Course syllabus

Basic R: Data handling [week 1]

  1. Data types
    1. Numeric
    2. Character (surrounded by quotes)
    3. Boolean
  2. Objects
    1. Atomic (or scalar): a single value
    2. Vector: many values
    3. Dataframe: table
    4. * List [*not necessary for basics]
    5. * Matrix, Array [*not necessary for basics]
  3. Assigning objects and variables
  4. Vectorizing calculations
  5. Filtering
  6. Installing packages
  7. Reading external data

Programming R [week 2]

  1. Writing functions
    1. Define a function: source
    2. Function arguments, defaults
    3. Declaring empty vectors
    4. Loops
    5. Debugging
    6. Return values
    7. Scope of variables
  2. Saving R objects

Maps with R's base package [week 3]

  1. Basic R graphing
  2. Plotting a dataframe with a line
  3. Basic cosmetics
    1. Color: col
    2. Point character: pch
    3. Point size: cex
    4. Axis: xlab, ylab, axes
  4. Structuring multiple polygons in a list
  5. Polygon vs. line
  6. UTM coordinates

GIS tools in R [week 4]

  1. Packages sp, maptools, rgdal
  2. Classes (type S4)
    1. SpatialPolygonsDataFrame
    2. SpatialPolygons
    3. Polygons
    4. Polygon
    5. Etc. for Lines, Points
  3. Subsetting the data
  4. Bounding box
  5. Maps
  6. Area

GIS rasters in R [week 5]

Spatial analyses [week 6]

Spatial analyses [week 7]

GPSVisualizer [week 8]


Principal R functions