readAttains: Read data from EPA's ATTAINS database

View source: R/readAttains.r

readAttainsR Documentation

Read data from EPA's ATTAINS database

Description

This function pulls information from EPA ATTAINS database based on submitted arguments via ATTAINS web service. Any ATTAINS web service compatible argument can be submitted to this funciton. Depending on type, at least one argument may be required. See https://www.epa.gov/waterdata/how-access-and-use-attains-web-services for a list of required and compatible arguments. The function is essentially an ATTAINS specific wrapper for jsonlite::fromJSON. It generates the appropriate web path to connect to ATTAINS web service and converts JSON to R object.

Usage

readAttains(type = "assessments", stateCode = NULL, ...)

Arguments

type

ATTAINS data type to read. One of: "assessmentUnits", "assessments", or "actions".

stateCode

Two letter state code

...

Additional arguments to be passed to ATTAINS web service path.

Value

Returns a data.frame or list of queried ATTAINS data. Note that some results may contain additional lists of results that can be further flattened.

Examples

#Read Utah assessment unit information
UT_AUs=readAttains(type="assessmentUnits", stateCode="UT")

#Read Utah actions
UT_actions=readAttains(type="actions", stateCode="UT")

#Read Utah assessments
UT_assessments=readAttains(type="assessments", stateCode="UT", reportingCycle=2020)

utah-dwq/udwqTools documentation built on July 17, 2024, 10:21 p.m.