This function downloads air quality data from the EPA and saves it to a directory.
Available parameter codes include:
44201 -- Ozone
42401 -- SO2
42101 -- CO
42602 -- NO2
88101 -- PM2.5
88502 -- PM2.5
81102 -- PM10
SPEC -- PM2.5
WIND -- Wind
TEMP -- Temperature
PRESS -- Barometric Pressure
RH_DP -- RH and dewpoint
HAPS -- HAPs
VOCS -- VOCs
NONOxNOy
epa_downloadData( year = NULL, parameterCode = "88101", downloadDir = tempdir(), baseUrl = "https://aqs.epa.gov/aqsweb/airdata/" )
year | year |
---|---|
parameterCode | pollutant code |
downloadDir | directoroy where monitoring data .zip file will be saved |
baseUrl | base URL for archived daily data |
Filepath of the downloaded zip file.
Unzipped CSV files are almost 100X larger than the compressed .zip files.
EPA AirData Pre-Generated Data Files
if (FALSE) { # Fail gracefully if any resources are not available try({ zipFile <- epa_downloadData(2016, "88101", '~/Data/EPA') tbl <- epa_parseData(zipFile, "PM2.5") }, silent = FALSE) }