epa_aqs_getCodes: Download and parse tables of EPA AQS codes

View source: R/epa_aqs_getCodes.R

epa_aqs_getCodesR Documentation

Download and parse tables of EPA AQS codes

Description

Download and parse code tables from the US EPA.

See https://www.epa.gov/aqs/aqs-code-list for a list of tables. the tableName can be determined by hovering over each link. For example, the tableName for the "General > Parameters" table is "parameters".

Usage

epa_aqs_getCodes(
  tableName = NULL,
  baseUrl = "https://aqs.epa.gov/aqsweb/documents/codetables/"
)

Arguments

tableName

Character name associated with the code table.

baseUrl

Character base URL for EPA AQS code tables.

Value

Tibble of EPA AQS codes.

Note

Column types are determined automatically by readr::read_csv() based on the first 1000 rows of input. In addition, any column matching " Code$" will be converted to 'character' type (typically from 'numeric'). It is up to the user to review column types (with dplyr::glimpse()) and reassign where desired.

References

AQS Codes and Descriptions

Examples

## Not run: 
library(AirMonitorIngest)

# Create a directory specifically for EPA data
dir.create("~/Data/EPA", recursive = TRUE)

# Set logging level so messages and errors will appear in the console
MazamaCoreUtils::initializeLogging(logDir = "~/Data/EPA/")
logger.setLevel(TRACE)

# Get a table of parameter codes
parameter_codes <- epa_aqs_getCodes(tableName = "parameters")

## End(Not run)

pnwairfire/AirMonitorIngest documentation built on Feb. 18, 2025, 7:50 p.m.