
Download EPA Air Quality Data (EPA AirData Flat Files)
get_epa_airdata.Rd
Downloads and stacks EPA air quality data for specified parameters with progress tracking.
Usage
get_epa_airdata(
analyte,
start_year,
end_year,
freq,
output_dir = "data/",
prompt_download = F,
archive = FALSE,
archive_id = NULL
)
Arguments
- analyte
Character string specifying the EPA analyte code (e.g., "88101" for PM2.5)
- start_year
Numeric value for the starting year of data collection
- end_year
Numeric value for the ending year of data collection
- freq
Character string specifying the frequency of analysis (e.g., "daily", "hourly", "annual")
- output_dir
Character string specifying the directory for downloaded files. Defaults to "data/"
- prompt_download
Boolean indicating whether to prompt user before downloading (default: False)
- archive
Logical. If
TRUE
, the function retrieves data from the Wayback Machine (Internet Archive) rather than the live EPA AirData website. Defaults toFALSE
.- archive_id
Character. The timestamp ID for the archived version of the EPA AirData website on the Wayback Machine (only used if
archive = TRUE
). Defaults to"20250126115248"
.
Value
A data frame containing the stacked EPA air quality data or NULL if no data is found or download is cancelled