Package {echor}


Type: Package
Title: Access EPA 'ECHO' Data
Version: 0.1.10
Maintainer: Michael Schramm <mpschramm@gmail.com>
Description: An R interface to United States Environmental Protection Agency (EPA) Environmental Compliance History Online ('ECHO') Application Program Interface (API). 'ECHO' provides information about EPA permitted facilities, discharges, and other reporting info associated with permitted entities. Data are obtained from https://echo.epa.gov/.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: curl, dplyr, httr, plyr, progress, purrr, readr, rlang, sf, tibble, tidyr (≥ 1.0.0), utils
Suggests: httptest, testthat, utf8
BugReports: https://github.com/mps9506/echor/issues
URL: https://github.com/mps9506/echor, https://mps9506.github.io/echor/
Language: en-US
Config/Needs/website: mps9506/mpsTemplates, ggplot2, ggrepel, ggspatial, here, kableExtra, knitr, prettymapr, raster, rmarkdown, sf
Config/Needs/coverage: xml2
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-09-11 19:03:04 UTC; michael.schramm
Author: Michael Schramm ORCID iD [aut, cre, cph]
Repository: CRAN
Date/Publication: 2026-09-11 20:10:27 UTC

Download Multiple DMRs

Description

Returns DMRs in a nested list using echoGetEffluent(). Uses a dataframe with a column of p_id numbers. Please note that p_id's are case sensitive.

Usage

downloadDMRs(df, idColumn, pBar = TRUE, verbose = FALSE, ...)

Arguments

df

dataframe with column of id numbers

idColumn

unquoted string, name of column containing the p_id permit numbers

pBar

logical, display a progress bar? Defaults to TRUE

verbose

logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE. Suggest leaving this FALSE if pBar = TRUE.

...

additional arguments passed to echoGetEffluent

Value

dataframe df, with a column containing the discharge monitoring reports downloaded with echoGetEffluentSummary

Examples


## This example requires an internet connection to run

## Retrieve multiple DMRs for flow

df <- tibble::tibble("id" = c('TX0119407', 'TX0132187'))
df <- downloadDMRs(df, id)


Downloads EPA ECHO permitted air emitter information

Description

Returns a dataframe or simplefeature dataframe of permitted facilities returned by the query. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/facility-search-air#!/Facilities/get_air_rest_services_get_facility_info

Usage

echoAirGetFacilityInfo(output = "df", verbose = FALSE, ...)

Arguments

output

Character string specifying output format. output = 'df' for a dataframe or output = 'sf' for a simple features spatial dataframe. See (https://CRAN.R-project.org/package=sf) for more information about simple features.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

...

Further arguments passed as query parameters in request sent to EPA ECHO's API. For more options see: https://echo.epa.gov/tools/web-services/facility-search-water#!/Facility_Information/get_air_rest_services_get_facility_info for a complete list of parameter options. Examples provided below.

Value

dataframe or sf dataframe suitable for plotting

Examples


## These examples require an internet connection to run

## Retrieve table of facilities by bounding box
echoAirGetFacilityInfo(p_c1lon = '-96.407563',
p_c1lat = '30.554395',
p_c2lon = '-96.25947',
p_c2lat = '30.751984',
output = 'df')

## Retrieve a simple features dataframe by bounding box
spatialdata <- echoAirGetFacilityInfo(p_c1lon = '-96.407563',
p_c1lat = '30.554395',
p_c2lon = '-96.25947',
p_c2lat = '30.751984',
output = 'sf')



Downloads EPA ECHO Air Facility Metadata

Description

Returns variable name and descriptions for parameters returned by echoAirGetFacilityInfo

Usage

echoAirGetMeta(verbose = FALSE)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

Value

returns a dataframe

Examples


## These examples require an internet connection to run

# returns a dataframe of
echoAirGetMeta()


Download EPA ECHO emissions inventory report data

Description

Download EPA ECHO emissions inventory report data

Usage

echoGetCAAPR(p_id, verbose = FALSE, ...)

Arguments

p_id

character string specify the identifier for the service. Required.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

...

Additional arguments

Value

dataframe

Examples


## This example requires an internet connection to run

echoGetCAAPR(p_id = '110000350174')



Downloads EPA ECHO DMR records of dischargers with NPDES permits

Description

Uses EPA ECHO API to download the Discharge Monitoring Record (DMR) of a single plant, identified with p_id. Please note that the p_id is case sensitive.

Usage

echoGetEffluent(p_id, verbose = FALSE, ...)

Arguments

p_id

Character string specify the identifier for the service. Required. Case sensitive.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

...

Further arguments passed on as query parameters sent to EPA's ECHO API. For more options see: https://echo.epa.gov/tools/web-services/effluent-charts#!/Effluent_Charts/get_eff_rest_services_get_effluent_chart

Value

Returns a dataframe.

Examples


## This example requires an internet connection to run

## Retrieve single DMR for flow

echoGetEffluent(p_id = 'tx0119407', parameter_code = '50050')


Downloads permitted facility information

Description

Provides interface for downloading facility information from Clean Air Act, Clean Water Act, and Safe Drinking Water Act permitted facilities.

Usage

echoGetFacilities(program, output = "df", verbose = FALSE, ...)

Arguments

program

Character, either program = 'caa', program = 'cwa', or program = 'sdw'. 'caa' retrieves facilities permitted under the Clean Air Act, 'cwa' retrieves facilities permitted under the Clean Water Act, and 'sdw' retrieves facilities permitted under the the Safe Drinking Water Act.

output

Character string specifying output format. output = 'df' for a dataframe or output = 'sf' for a simple features spatial dataframe. 'sf' only applies to CAA and CWA queries.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

...

Further arguments passed as query parameters in request sent to EPA ECHO's API.

Value

dataframe or sf dataframe suitable for plotting


Downloads self reported discharge and emissions data

Description

Downloads self reported discharge and emissions data

Usage

echoGetReports(program, p_id, verbose = FALSE, ...)

Arguments

program

Character, one of program = 'caa', program = 'cwa', or program = 'nncr'. 'caa' retrieves facilities permitted under the Clean Air Act, 'cwa' retrieves facilities permitted under the Clean Water Act, and 'nncr' retrieves NPDES Noncompliance Report (NNCR) data for a facility or NPDES permit.

p_id

Character string specify the identifier for the service. For program = 'nncr', this is treated as the NPDES permit ID (permits__npdes_id). Required.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

...

Further arguments passed on as query parameters sent to EPA's ECHO API.

Value

Returns a dataframe


Downloads available NPDES Noncompliance Report (NNCR) fiscal year quarters

Description

Returns the fiscal year quarters ('fy_quarter') available for use with echoNNCRGetSearch, echoNNCRGetViolations, and echoGetReports, along with the quarter's date range and release status. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/npdes-noncompliance-report.

Usage

echoNNCRGetQuarters(verbose = FALSE)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

Value

Returns a dataframe.

Examples


## This example requires an internet connection to run

echoNNCRGetQuarters()


Downloads a NPDES Noncompliance Report (NNCR) facility/permit report

Description

Returns compliance and enforcement history for one or more facilities or NPDES permits at a time, across all available quarters. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/npdes-noncompliance-report.

Usage

echoNNCRGetReport(verbose = FALSE, ...)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

...

Further arguments passed as query parameters in the request sent to EPA ECHO's API. One of frs_id, frs_id__in, permits__npdes_id, or permits__npdes_id__in is required. For a complete list of parameter options, see the web services documentation linked above.

Value

Returns a dataframe. Nested facility, permit, and violation-level detail returned by the service is preserved as list-columns.

Examples


## This example requires an internet connection to run

echoNNCRGetReport(permits__npdes_id = "TX0119407")


Searches the NPDES Noncompliance Report (NNCR)

Description

Returns a dataframe of permits and their summarized violation counts for a given fiscal year quarter, matching the search criteria. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/npdes-noncompliance-report.

Usage

echoNNCRGetSearch(verbose = FALSE, ...)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

...

Further arguments passed as query parameters in the request sent to EPA ECHO's API. fy_quarter is required; see echoNNCRGetQuarters for valid values. For a complete list of parameter options, including Django-style field lookups such as permit_state__in or permit_name__icontains, see the web services documentation linked above.

Value

Returns a dataframe.

See Also

echoNNCRGetQuarters

Examples


## This example requires an internet connection to run

echoNNCRGetSearch(fy_quarter = "FY24Q4", permit_state = "TX")


Downloads detailed NPDES Noncompliance Report (NNCR) violations

Description

Returns a dataframe of detailed violation records for a given fiscal year quarter, optionally filtered to a single facility (frs_id) or NPDES permit (npdes_id). Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/npdes-noncompliance-report.

Usage

echoNNCRGetViolations(verbose = FALSE, ...)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE.

...

Further arguments passed as query parameters in the request sent to EPA ECHO's API. fy_quarter is required; see echoNNCRGetQuarters for valid values. For a complete list of parameter options, see the web services documentation linked above.

Value

Returns a dataframe.

See Also

echoNNCRGetQuarters

Examples


## This example requires an internet connection to run

echoNNCRGetViolations(fy_quarter = "FY24Q4", npdes_id = "TX0119407")


Downloads EPA ECHO Safe Drinking Water Facilities Metadata

Description

Downloads EPA ECHO Safe Drinking Water Facilities Metadata

Usage

echoSDWGetMeta(verbose = FALSE)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

Value

returns a dataframe

Examples


## These examples require an internet connection to run

# returns a dataframe of
echoSDWGetMeta()


Downloads public water system information

Description

Returns a dataframe of permitted public water systems returned by the query. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/facility-search-drinking-water#!/Safe_Drinking_Water/get_sdw_rest_services_get_systems.

Usage

echoSDWGetSystems(verbose = FALSE, ...)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

...

Further arguments passed as query parameters in request sent to EPA ECHO's API. For more options see: https://echo.epa.gov/tools/web-services/facility-search-drinking-water#!/Safe_Drinking_Water/get_sdw_rest_services_get_systems for a complete list of parameter options. Examples provided below.

Value

returns a dataframe

Examples


## These examples require an internet connection to run
echoSDWGetSystems(p_co = "Brazos", p_st = "tx")


Downloads EPA ECHO water facility information

Description

Returns a dataframe or simplefeature dataframe of permitted facilities returned by the query. Uses EPA's ECHO API: https://echo.epa.gov/tools/web-services/facility-search-water.

Usage

echoWaterGetFacilityInfo(output = "df", verbose = FALSE, ...)

Arguments

output

Character string specifying output format. output = 'df' for a dataframe or output = 'sf' for a simple features spatial dataframe. See (https://CRAN.R-project.org/package=sf) for more information about simple features.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

...

Further arguments passed as query parameters in request sent to EPA ECHO's API. For more options see: https://echo.epa.gov/tools/web-services/facility-search-water#!/Facility_Information/get_cwa_rest_services_get_facility_info for a complete list of parameter options. Examples provided below.

Value

returns a dataframe or simple features dataframe

Examples


## These examples require an internet connection to run

## Retrieve table of facilities by bounding box
echoWaterGetFacilityInfo(p_c1lon = '-96.407563',
p_c1lat = '30.554395',
p_c2lon = '-96.25947',
p_c2lat = '30.751984',
p_pcomp = 'POT',
output = 'df')

## Retrieve a simple features dataframe by bounding box
spatialdata <- echoWaterGetFacilityInfo(p_c2lon = '-96.407563',
p_c1lat = '30.554395',
p_c2lon = '-96.25947',
p_c2lat = '30.751984',
p_pcomp = 'POT',
output = 'sf')




Downloads EPA ECHO Water Facility Metadata

Description

Returns variable name and descriptions for parameters returned by echoWaterGetFacilityInfo

Usage

echoWaterGetMeta(verbose = FALSE)

Arguments

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

Value

returns a dataframe

Examples


## These examples require an internet connection to run

# returns a dataframe of
echoWaterGetMeta()


Search parameter codes for Clean Water Act permits on EPA ECHO

Description

Returns a dataframe of parameter codes and descriptions.

Usage

echoWaterGetParams(term = NULL, code = NULL, verbose = FALSE)

Arguments

term

Character string specifying the parameter search term. Partial or complete search phrase or word.

code

Character string specifying the parameter search code value.

verbose

Logical, indicating whether to provide processing and retrieval messages. Defaults to FALSE

Value

Returns a dataframe.

Examples


## These examples require an internet connection to run

## Retrieve parameter codes for dissolved oxygen
echoWaterGetParams(term = "Oxygen, dissolved")

echoWaterGetParams(code = "00300")


Check responses

Description

Checks for valid server response and passes silently or produces a useful message.

Usage

resp_check(response)

Arguments

response

response a [httr::GET()] request result returned from the API

Value

nothing if check is passed, or an informative message if not passed.