Skip to content

MazamaScience/ASIC-2026

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Workshop on R Packages for Air Quality Data

Last updated April 29, 2026


This workshop will introduce participants to two open source R packages designed specifically for working with air quality data from regulatory monitors and low-cost sensors. The AirMonitor and AirSensor2 packages have been developed with funding from, and have been used by the US EPA, the US Forest Service and the South Coast Air Quality Management District. These R packages are part of a suite of R packages that provide core functionality for environmental monitoring at fixed locations. The full suite of packages represent a decade of continuous development with a focus on compact data formats, robust data analysis, compelling data visualization and a simple, easy-to-learn coding style.

Goals

Attendees will become familiar with the AirMonitor and AirSensor2 R packages and will be able to quickly download, process and visualize data from AirNow and sensor manufacturers PurpleAir, Clarity and AirGradient. Various analysis and data visualization functions will be introduced but the focus will be on data access and the creation of uniform dataframes of hourly measurements appropriate for use in research studies and reports.

Audience

The R packages presented provide functionality for data ingest and manipulation and are designed for individuals who sometimes need to work independently, i.e. without the support of IT staff. The target audience includes anyone who works with Air Quality data from regulatory monitors and low cost sensors and who is a regular user of R/RStudio. Attendees should have a basic understanding of R data types and common functions. Familiarity with the dplyr package will be especially helpful.

R Packages for Environmental Time Series

Over the last decade, Jonathan Callahan has been responsible for the creation of multiple open source R packages focused on environmental monitoring time series. These are used operationally in data processing, analysis and visualization systems at the US Forest Service AirFire Team, in the EPA AirNow Fire & Smoke map and elsewhere.

The following R packages are actively maintained:

Each package has a dedicated Slack channel for announcements, support and to help build communities of practice around these shared tools. You may request an invitation to join from jonathan.callahan@dri.edu.

Workshop Preparation

Attendees are strongly encouraged to install the required packages and data files before the workshop begins.

As with any hands-on workshop, advanced preparation by individuals will allow us to quickly start working with data. Please ensure that the following software and data files have been installed on your laptop in advance of the workshop:

R and RStudio

This workshop is designed for those who are already familiar with R and RStudio and use them on a regular basis.

Ensure that you are running R version 4.4 or higher.

Ensure that you have installed RStudio Desktop version 2025.09 or higher.

Installing packages

Most (but not all) of the packages we will be using are available on CRAN. However, several packages have been updated in preparation of this workshop. Please install the latest versions of these packages from GitHub.

Type the following commands at the RStudio Console prompt to get fully updated:

install.packages("AirMonitor")

install.packages("devtools")

devtools::install_github("mazamascience/MazamaCoreUtils")
devtools::install_github("mazamascience/MazamaTimeSeries")
devtools::install_github("mazamascience/AirMonitor")
devtools::install_github("mazamascience/AirMonitorPlots")
devtools::install_github("mazamascience/AirSensor2")

Spatial data

The MazamaSpatialUtils package is used to enhance spatial metadata when ingesting sensor data. Simplified spatial datasets for countries and timezones are installed with the package but other, larger datasets must be installed manually in a dedicated directory. Work with the AirSensor2 package requires installation of datasets with state and county boundaries.

The default location for spatial data used in this workshop is underneath your home directory in ~/Data/Spatial/. The following chunk of code will create this directory and populate it with the required datasets.

At the RStudio Console prompt type:

dir.create("~/Data/Spatial", recursive = TRUE)
MazamaSpatialUtils::setSpatialDataDir("~/Data/Spatial")
MazamaSpatialUtils::installSpatialData("NaturalEarthAdm1")
MazamaSpatialUtils::installSpatialData("USCensusCounties")

Workshop repository

Finally, you should install all of the documentation, data and scripts for this workshop by cloning this repository.

From RStudio

You can create a new project from a GitHub repository by using the RStudio menubar:

  1. File > New Project...
  2. Version Control > Git
  3. URL: https://github.com/MazamaScience/ASIC-2026.git

Choose a directory into which to clone the repository, check "Open in new session" and then press "Create Project".

From a terminal

If you prefer, you can use a separate terminal window or the RStudio Terminal window to issue a shell command to clone the GitHub repository.

At the terminal prompt, type:

git clone git@github.com:mazamascience/ASIC-2026.git

If you don't have a git account or can't log in, you may need to use the https location:

git clone https://github.com/MazamaScience/ASIC-2026.git

Workshop Contents

During the workshop, we will work through the numbered scripts found in R_workshop/R/:

R/
├── 01_AirMonitor_recipes.R
├── 02_AirSensor2_PurpleAir_recipes.R
└── 03_AirSensor2_OpenAQ_recipes.R

Each of these scripts is well commented so that anyone should be able to work through them in order if you have installed the necessary libraries and datasets.

Interim datasets obtained using API keys have been saved to the data/ directory so that you can follow along even if you don't have any API keys.


Congratulations!

You have finished installing all required software for this workshop.

About

Slides and workshop materials for the 2026 Air Sensors International Conference

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages