Spatial Analysis in R

with a Focus on Environmental Health

An introduction to spatial analysis in R, with interactive modules that demonstrate various spatial packages, including:

  • sf
  • stars
  • leaflet
  • plotKML
  • tmap
  • arcpullr
  • osmdata
  • ggplot2
  • tigris
  • acs

Interactive Learning Modules

Interactive modules that accompany a workshop of lectures, discussions, and learning activities.

Summer 2022 Workshop syllabus

Examples covered the modules include:

  • Reading shapefiles and rasters
  • Accessing data from ArcGIS Online
  • Interactive maps in leaflet and tmap
  • Importing GPS gpx files
  • Assigning satellite and low-cost sensor based PM2.5 exposures
  • Developing a real-time COVID-19 dashboard
  • Greenspace and near roadway analysis using OpenStreetMap data


Edmund Seto
Associate Professor
Environmental & Occupational Health Sciences
University of Washington

Course Description

This is an introductory course in analyzing spatial data in R. The course is built largely on examples from Environmental Health and Environmental Epidemiology. The course will describe common types of spatial datasets used in the Environmental Health Sciences and Epidemiology, including population census data, air pollution data, land use and land cover data, and data collected from mobile apps. Geographic Information System/Science (GIS) and spatial analysis methods for creating maps and for identifying spatial relationships will be described. Course modules will cover applications in air pollution, infectious disease, built environment, and environmental justice. The course will be taught using open source software, R and its packages for spatial analysis.

The online course material was developed in learnr and contains R code that can be run in real-time on the website.

You will find exercises and quizes embedded in the course modules that reinforce key learning objectives.

Applicable to non-US learners too

This online course material is different from the hybrid course that I teach at the University of Washington. That course focuses on ESRI ArcGIS skills for Public Health.

This online material was developed with largely non-US data as examples. Non-US learners may find these examples more applicable to their work. But US-based learners may also benefit from the examples too. There are a few US-based examples in some modules.

Course level (Beginner)

This course isn’t applicable to those looking for advanced spatial statistical modeling methods. This is a beginner course that provides examples of working with spatial data with some examples related to Environmental Health and Epidemiology.