Package: epair 1.1.0

G.L. Orozco-Mulfinger

epair: EPA Data Helper for R

Aid the user in making queries to the EPA API site found at https://aqs.epa.gov/aqsweb/documents/data_api. This package combines API calling methods from various web scraping packages with specific strings to retrieve data from the EPA API. It also contains easy to use loaded variables that help a user navigate services offered by the API and aid the user in determining the appropriate way to make a an API call.

Authors:G.L. Orozco-Mulfinger [aut, cre], Madyline Lawrence [aut], Owais Gilani [aut]

epair_1.1.0.tar.gz
epair_1.1.0.zip(r-4.5)epair_1.1.0.zip(r-4.4)epair_1.1.0.zip(r-4.3)
epair_1.1.0.tgz(r-4.5-any)epair_1.1.0.tgz(r-4.4-any)epair_1.1.0.tgz(r-4.3-any)
epair_1.1.0.tar.gz(r-4.5-noble)epair_1.1.0.tar.gz(r-4.4-noble)
epair_1.1.0.tgz(r-4.4-emscripten)epair_1.1.0.tgz(r-4.3-emscripten)
epair.pdf |epair.html
epair/json (API)
NEWS

# Install 'epair' in R:
install.packages('epair', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Reviews:rOpenSci Software Review #418

Bug tracker:https://github.com/ropensci/epair/issues

Pkgdown site:https://docs.ropensci.org

Datasets:

On CRAN: no

Conda:

4.89 score 7 stars 11 scripts 72 exports 21 dependencies

Last updated 3 years agofrom:6eedb899c8 (on master). Checks:9 OK. Indexed: yes.

TargetResultLatest binary
Doc / VignettesOKMar 14 2025
R-4.5-winOKMar 14 2025
R-4.5-macOKMar 14 2025
R-4.5-linuxOKMar 14 2025
R-4.4-winOKMar 14 2025
R-4.4-macOKMar 14 2025
R-4.4-linuxOKMar 14 2025
R-4.3-winOKMar 14 2025
R-4.3-macOKMar 14 2025

Exports:add.variablesclear.all.cachedclear.cachedcreate.authenticationget_all_masget_all_pqaosget_aqs_keyget_cbsasget_counties_in_stateget_fields_by_serviceget_known_issuesget_monitors_in_bboxget_monitors_in_cbsaget_monitors_in_countyget_monitors_in_siteget_monitors_in_stateget_parameter_classesget_parameters_in_classget_qa_ape_in_agencyget_qa_ape_in_countyget_qa_ape_in_pqaoget_qa_ape_in_siteget_qa_ape_in_stateget_qa_blanks_in_agencyget_qa_blanks_in_countyget_qa_blanks_in_pqaoget_qa_blanks_in_siteget_qa_blanks_in_stateget_qa_ca_in_agencyget_qa_ca_in_countyget_qa_ca_in_pqaoget_qa_ca_in_siteget_qa_ca_in_stateget_qa_fra_in_agencyget_qa_fra_in_countyget_qa_fra_in_pqaoget_qa_fra_in_siteget_qa_fra_in_stateget_qa_frv_in_agencyget_qa_frv_in_countyget_qa_frv_in_pqaoget_qa_frv_in_siteget_qa_frv_in_stateget_qa_pep_in_agencyget_qa_pep_in_countyget_qa_pep_in_pqaoget_qa_pep_in_siteget_qa_pep_in_stateget_qa_qc_in_agencyget_qa_qc_in_countyget_qa_qc_in_pqaoget_qa_qc_in_siteget_qa_qc_in_stateget_revision_historyget_sites_in_countyget_state_fipsget_tf_qa_ape_in_agencyget_tf_qa_ape_in_countyget_tf_qa_ape_in_pqaoget_tf_qa_ape_in_siteget_tf_qa_ape_in_stateget_tf_sample_in_agencyget_tf_sample_in_countyget_tf_sample_in_siteget_tf_sample_in_stateis_API_runninglist.cached.datanon.cached.perform.callperform.callperform.call.rawretrieve.cached.callsave.new.cached.call

Dependencies:askpassclicurldigestgluehttrjsonlitelifecyclemagrittrmimeopensslR.cacheR.methodsS3R.ooR.utilsR6rlangstringistringrsysvctrs

Clarification on terminology

Rendered froma02_ClarificationTerm.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

epair

Rendered fromepair.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-10-23
Started: 2021-07-17

Finding endpoints

Rendered froma08_Endpoints.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

Installation

Rendered froma03_Installation.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

Make a more complex call

Rendered froma06_make-a-more-complex-call.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2022-06-01
Started: 2021-11-28

Making your first call

Rendered froma05_making-your-first-call.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2022-06-01
Started: 2021-11-28

Navigating API Services

Rendered froma09_Services.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

Setup

Rendered froma04_setup.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

Summary

Rendered froma07_wrap-up.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2022-06-01
Started: 2021-11-28

The Anatomy of an EPA API request

Rendered froma01_ananomyEPARequest.Rmdusingknitr::rmarkdownon Mar 14 2025.

Last update: 2021-11-28
Started: 2021-11-28

Citation

To cite package ‘epair’ in publications use:

Orozco-Mulfinger G, Lawrence M, Gilani O (2025). epair: EPA Data Helper for R. R package version 1.1.0, https://github.com/ropensci/epair.

Corresponding BibTeX entry:

  @Manual{,
    title = {epair: EPA Data Helper for R},
    author = {G.L. Orozco-Mulfinger and Madyline Lawrence and Owais
      Gilani},
    year = {2025},
    note = {R package version 1.1.0},
    url = {https://github.com/ropensci/epair},
  }

Readme and manuals

epair

A package designed to aid in getting data from the Environmental Protection Agency (EPA) API at https://aqs.epa.gov/aqsweb/documents/data_api.html.

Overview

The epair package helps you determine what data you want and how to get that data from the EPA API. It provides loaded in variables that help you navigate services in the API, and a simple way to query the data.

Broadly, you can explore possible calls by typing epair::get_ and seeing what autocomplete offers in R. Most of these functions require a start and end date along with a geographical boundary type (like CBSA code or bounding box). For more details, we recommend looking at the help docs ?epair::get_[type]() for the function you're interested in using to see the exact required params.

Installation

You can download the package simply by using r-universe.

install.packages("epair", repos = "https://ropensci.r-universe.dev")

Alternativately, you can download the latest release from this repo using devtools.

devtools::install_github("ropensci/epair")

Or, download these files, and in your working directory run the following.

devtools::install("ropensci/epair")

epair depends on httr for making its data calls and rvest for creating the variables loaded in with the package. We recommend having httr installed (automatically taken care of through package dependencies), and only installing rvest if you're curious about how package variables were made.

Usage notes

Note that currently a single call to AQS allows for at maximum a single year's worth of data. You'll need to create separate calls to get multiple year's worth of data.

ropenaq

You may want to check out ropenaq instead depending on the goals behind your study. ropenaq is an R wrapper for accessing the OpenAQ API - see its website here. Here are a few differences:

  • epair will get data from a single source (EPA AQS API), while ropenaq will be more useful if you’re trying to compare data from different sources.

  • If you're interested in data for the US only, epair would be an appropriate choice. For more locations across the world, ropenaq would work better.

  • epair’s data source does offer more granularity than OpenAQ for US data. The EPA AQS API can give over 500 parameters/pollutants of interest (as opposed to OpenAQ’s 5), county level coverage, and unaggregated raw data. By default, OpenAQ will give aggregated data so if you're only interested in aggregations, then OpenAQ is the way to go.

Terms of Service

Make sure you also see the Usage Tips and Terms of Service associated with using this API at https://aqs.epa.gov/aqsweb/documents/data_api.html.

Help Manual

Help pageTopics
Add variables to a queryadd.variables
Removes all cached memory of perform.callclear.all.cached
Removes memory of cached perform.call data for specific parametersclear.cached
Generate the string authentication needed for EPA APIcreate.authentication
Make the first call when forming a query.create.base.call
Endpoints available in the EPA APIendpoints
Get Monitoring Agencies.get_all_mas
Get Primary Quality Assurance Organizations.get_all_pqaos
Get annual summary data in a bounding box (lat, long).get_annual_summary_in_bbox
Get annual summary data in a Core Based Statistical Area.get_annual_summary_in_cbsa
Get annual summary data in a county.get_annual_summary_in_county
Get annual summary data at a measurement site.get_annual_summary_in_site
Get annual summary data in a state.get_annual_summary_in_state
Get an API key from the AQS API.get_aqs_key
Get all Core Based Statistical Areas.get_cbsas
Get all counties within a state.get_counties_in_state
Returns daily summary data given a bounding box (lat, long).get_daily_summary_in_bbox
Get daily summary data in a Core Based Statistical Area.get_daily_summary_in_cbsa
Returns data summarized by day at the county level.get_daily_summary_in_county
Returns data summarized by day at measurement site level.get_daily_summary_in_site
Returns daily data at the state level.get_daily_summary_in_state
Get fields required per service.get_fields_by_service
Get any known issues within the API.get_known_issues
Get all monitoring sites within a bounding box (lat, long).get_monitors_in_bbox
Get monitors within a Core Based Statistical Area.get_monitors_in_cbsa
Get all monitors in a county.get_monitors_in_county
Get all monitors at a site.get_monitors_in_site
Get monitors in state.get_monitors_in_state
Get all types of parameters.get_parameter_classes
Get all parameters available within a particular parameter class.get_parameters_in_class
Get quality assurance annual performance evaluations for a monitoring agency.get_qa_ape_in_agency
Get quality assurance annual performance evaluations in a county.get_qa_ape_in_county
Get quality assurance annual performance evaluations for a primary quality assurance organization.get_qa_ape_in_pqao
Get quality assurance annual performance evaluations at a site.get_qa_ape_in_site
Get quality assurance annual performance evaluations in a state.get_qa_ape_in_state
Get quality assurance blank data for a monitoring agency.get_qa_blanks_in_agency
Get quality assurance blank data in a county.get_qa_blanks_in_county
Get quality assurance blank data for a primary quality assurance organization.get_qa_blanks_in_pqao
Get quality assurance blank data at a site.get_qa_blanks_in_site
Get quality assurance blank data in a state.get_qa_blanks_in_state
Get quality assurance collocated assessment data for a monitoring agency.get_qa_ca_in_agency
Get quality assurance collocated assessment data in a county.get_qa_ca_in_county
Get quality assurance collocated assessment data for a primary quality assurance organization.get_qa_ca_in_pqao
Get quality assurance collocated assessment data at a site.get_qa_ca_in_site
Get quality assurance collocated assessment data in a state.get_qa_ca_in_state
Get quality assurance flow rate audit data for a monitoring agency.get_qa_fra_in_agency
Get quality assurance flow rate audit data in a county.get_qa_fra_in_county
Get quality assurance flow rate audit data for a primary quality assurance organization.get_qa_fra_in_pqao
Get quality assurance flow rate audit data at a site.get_qa_fra_in_site
Get quality assurance flow rate audit data in a state.get_qa_fra_in_state
Get quality assurance flow rate verification data for a monitoring agency.get_qa_frv_in_agency
Get quality assurance flow rate verification data in a county.get_qa_frv_in_county
Get quality assurance flow rate verification data for a primary quality assurance organization.get_qa_frv_in_pqao
Get quality assurance flow rate verification data at a site.get_qa_frv_in_site
Get quality assurance flow rate verification data in a state.get_qa_frv_in_state
Get quality assurance PEP audit data for a monitoring agency.get_qa_pep_in_agency
Get quality assurance PEP audit data in a county.get_qa_pep_in_county
Get quality assurance PEP audit data for a primary quality assurance organization.get_qa_pep_in_pqao
Get quality assurance PEP audit data at a site.get_qa_pep_in_site
Get quality assurance PEP audit data in a state.get_qa_pep_in_state
Get quality assurance one point quality control data for a monitoring agency.get_qa_qc_in_agency
Get quality assurance annual one point quality control data in a county.get_qa_qc_in_county
Get quality assurance one point quality control data for a primary quality assurance organization.get_qa_qc_in_pqao
Get quality assurance one point quality control data at a site.get_qa_qc_in_site
Get quality assurance one point quality control data in a state.get_qa_qc_in_state
Get quarterly summary data in a bounding box (lat, long).get_quarterly_summary_in_bbox
Get quarterly summary data in a Core Based Statistical Area.get_quarterly_summary_in_cbsa
Get quarterly summary data in a county.get_quarterly_summary_in_county
Returns data summaries by yearly quarter.get_quarterly_summary_in_site
Get quarterly summary data in a state.get_quarterly_summary_in_state
Get the API's revision history.get_revision_history
Get samples (finest grained data) for a bounding box (lat, long).get_samples_in_bbox
Get samples (finest grained data) for a Core Based Statistical Area.get_samples_in_cbsa
Get samples (finest grained data) for a county.get_samples_in_county
Get samples (finest grained data) for a measurement site.get_samples_in_site
Get samples (finest grained data) for a state.get_samples_in_state
Get all measurement sites within a county.get_sites_in_county
Get all FIPS codes for each US state.get_state_fips
Get quality assurance annual performance evaluations for a monitoring agency in transaction format.get_tf_qa_ape_in_agency
Get quality assurance annual performance evaluations in a county in transaction format.get_tf_qa_ape_in_county
Get quality assurance annual performance evaluations for a primary quality assurance organization in transaction format.get_tf_qa_ape_in_pqao
Get quality assurance annual performance evaluations at a site in transaction format.get_tf_qa_ape_in_site
Get quality assurance annual performance evaluations in a state in transaction format.get_tf_qa_ape_in_state
Get sample data in the transaction format for a monitoring agency.get_tf_sample_in_agency
Get sample data in the transaction format in a county.get_tf_sample_in_county
Get sample data in the transaction format at a site.get_tf_sample_in_site
Get sample data in the transaction format in a state.get_tf_sample_in_state
Transpose a data frameget.transpose
Check if the API is up and runningis_API_running
Shows contents of cache directorylist.cached.data
Remove tabs, new lines, and empty spaces from entries in a listlist.remove.escapes.spaces
Replace every string entry in a listlist.string.replacer
Internal function to perform geospatial lookup by bounding box (lat, long).lookup_by_bbox
Internal function to perform geospatial lookup by Core Based Statistical Area.lookup_by_cbsa
Internal function to perform geospatial lookup by county.lookup_by_county
Internal function to perform geospatial lookup by monitoring agency.lookup_by_ma
Internal function to perform geospatial lookup by primary quality assurance organization.lookup_by_pqao
Internal function to perform geospatial lookup by site.lookup_by_site
Internal function to perform geospatial lookup by state.lookup_by_state
Perform call and convert data into listnon.cached.perform.call
Cached version of the perform.call functionperform.call
Perform call and keep original resultperform.call.raw
Place the URL as a call to the EPA APIplace.call
Perform call and maintain JSON Lite structureplace.call.raw
Remove tabs, new lines, and empty spaces from entries in a data frameremove.escapes.spaces
Retrieves memory of previously cached call.retrieve.cached.call
Saves a new call that has not been previously cached yet.save.new.cached.call
Names of services offered by the EPA APIservice.names
Services offered by the EPA APIservices
Replace all characters entries in data framestring.replacer
Variable parameter names to usevariable.types
Variables used for querying in EPA APIvariables