Skip to contents

Goals of this Notebook

This notebook orients you to tidypollute functions in a functional example (pun intended).


This request receives data from EPA AirData flat files, for analyte (pollutant) == LEAD over a given time range.

library(tidypollute)

Get Analyte Codes

tidypollute::epa_analyte_codes
## # A tibble: 21 × 2
##    label                          analyte        
##    <chr>                          <chr>          
##  1 Concentration by Monitor       conc_by_monitor
##  2 AQI by CBSA                    aqi_by_cbsa    
##  3 AQI by County                  aqi_by_county  
##  4 Ozone (44201)                  44201          
##  5 SO2 (42401)                    42401          
##  6 CO (42101)                     42101          
##  7 NO2 (42602)                    42602          
##  8 PM2.5 FRM/FEM Mass (88101)     88101          
##  9 PM2.5 non FRM/FEM Mass (88502) 88502          
## 10 PM10 Mass (81102)              81102          
## # ℹ 11 more rows
epa_zip_links <- get_epa_airdata_zip_links()
head(epa_zip_links)
## # A tibble: 6 × 5
##   year  unit_of_analysis analyte         url                 analyte_description
##   <chr> <chr>            <chr>           <chr>               <chr>              
## 1 all   aqs              sites           https://aqs.epa.go… Monitoring sites m…
## 2 all   aqs              monitors        https://aqs.epa.go… Air quality monito…
## 3 2024  annual           conc_by_monitor https://aqs.epa.go… Annual concentrati…
## 4 2024  annual           aqi_by_cbsa     https://aqs.epa.go… Annual AQI by Core…
## 5 2024  annual           aqi_by_county   https://aqs.epa.go… Annual AQI by coun…
## 6 2023  annual           conc_by_monitor https://aqs.epa.go… Annual concentrati…

Get Data: Lead, from 1999-2000

lead <- get_epa_airdata(analyte = "LEAD", 
                        start_year = 1999, 
                        end_year = 2000, 
                        freq = "daily")
## 
## Preparing to download:
## Analyte: LEAD 
## Years: 1999 to 2000 
## Number of files: 2 
## Freq of data: daily 
## Output directory: data/

Summary

This notebook provides an orientation to the various tidypollute functions.

For more details, check out tidypollute documentation.