- Notifications
You must be signed in to change notification settings - Fork0
💧 Access EPA ATTAINS data in R 💧
License
Unknown, MIT licenses found
Licenses found
mps9506/rATTAINS
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
rATTAINS provides functions for downloading tidy data from the UnitedStates (U.S.) Environmental Protection Agency (EPA)ATTAINS webservice. ATTAINS isthe online system used to track and report Clean Water Act assessmentsand Total Maximum Daily Loads (TMDLs) in U.S. surface waters. rATTAINSfacilitates access to thepublic informationwebservicemade available through the EPA.
rATTAINS is on CRAN:
install.packages('rATTAINS')Or install the development version from r-universe:
install.packages('rATTAINS', repos = 'https://mps9506.r-universe.dev')There are eight user available functions that correspond with the firsteight web services detailed byEPA.All arguments are case sensitive. By default the functions attempt toprovide flattened “tidy” data as a single or multiple dataframes. Byusing thetidy = FALSE argument in the function below, the raw JSONwill be read into the session for the user to parse if desired. This canbe useful since some webservices provide different results based on thequery and the tidying process used in rATTAINS might make poorassumptions in the data flattening process. If the function returnsunexpected results, try parsing the raw JSON string.
state_summary()provides summary information for assessed uses fororganizations and by integrated reporting cycle.huc_12_summary()provides summary information about impairments,actions, and documents for the specified 12-digit HUC (watershed).actions()provides a summary of information for particularfinalized actions (TMDLs and related).assessments()provides summary data about the specified assessmentdecisions by waterbody.plans()returns a summary of the plans (TMDLs and related) withina specified HUC.domain_values()returns allowed values in ATTAINS. By default (noarguments) the function returns a list of alloweddomain_names.assessment_units()returns a summary of information about thespecified assessment units.surveys()returns results from state statistical survey results inATTAINS.
Get a summary about assessed uses from the Texas Commission onEnvironmental Quality:
library(rATTAINS)state_summary( organization_id = "TCEQMAIN", reporting_cycle = "2020", .unnest = FALSE)#> $items#> # A tibble: 31 × 18#> organizationIdentifier organizationName organizationTypeText reportingCycle#> <chr> <chr> <chr> <chr> #> 1 TCEQMAIN Texas State 2020 #> 2 TCEQMAIN Texas State 2020 #> 3 TCEQMAIN Texas State 2020 #> 4 TCEQMAIN Texas State 2020 #> 5 TCEQMAIN Texas State 2020 #> 6 TCEQMAIN Texas State 2020 #> 7 TCEQMAIN Texas State 2020 #> 8 TCEQMAIN Texas State 2020 #> 9 TCEQMAIN Texas State 2020 #> 10 TCEQMAIN Texas State 2020 #> # ℹ 21 more rows#> # ℹ 14 more variables: cycleStatus <chr>, combinedCycles <list>,#> # waterTypeCode <chr>, unitsCode <chr>, useName <chr>,#> # `Fully Supporting` <dbl>, `Fully Supporting-count` <int>,#> # `Insufficient Information` <dbl>, `Insufficient Information-count` <int>,#> # `Not Assessed` <dbl>, `Not Assessed-count` <int>, `Not Supporting` <dbl>,#> # `Not Supporting-count` <int>, parameters <list>Get a summary about assessed uses, parameters and plans in a HUC12:
df <- huc12_summary(huc = "020700100204", .unnest = FALSE)tidyr::unnest(df, items) |> tidyr::unnest(summaryByUseGroup)#> # A tibble: 4 × 24#> huc12 assessmentUnitCount totalCatchmentAreaSqMi totalHucAreaSqMi#> <chr> <int> <dbl> <dbl>#> 1 020700100204 18 46.1 46.2#> 2 020700100204 18 46.1 46.2#> 3 020700100204 18 46.1 46.2#> 4 020700100204 18 46.1 46.2#> # ℹ 20 more variables: assessedCatchmentAreaSqMi <dbl>,#> # assessedCatchmentAreaPercent <dbl>, assessedGoodCatchmentAreaSqMi <int>,#> # assessedGoodCatchmentAreaPercent <int>,#> # assessedUnknownCatchmentAreaSqMi <int>,#> # assessedUnknownCatchmentAreaPercent <int>,#> # containImpairedWatersCatchmentAreaSqMi <dbl>,#> # containImpairedWatersCatchmentAreaPercent <dbl>, …tidyr::unnest(df, items) |> tidyr::unnest(summaryByParameterImpairments, names_repair = "minimal")#> # A tibble: 16 × 26#> huc12 assessmentUnitCount totalCatchmentAreaSqMi totalHucAreaSqMi#> <chr> <int> <dbl> <dbl>#> 1 020700100204 18 46.1 46.2#> 2 020700100204 18 46.1 46.2#> 3 020700100204 18 46.1 46.2#> 4 020700100204 18 46.1 46.2#> 5 020700100204 18 46.1 46.2#> 6 020700100204 18 46.1 46.2#> 7 020700100204 18 46.1 46.2#> 8 020700100204 18 46.1 46.2#> 9 020700100204 18 46.1 46.2#> 10 020700100204 18 46.1 46.2#> 11 020700100204 18 46.1 46.2#> 12 020700100204 18 46.1 46.2#> 13 020700100204 18 46.1 46.2#> 14 020700100204 18 46.1 46.2#> 15 020700100204 18 46.1 46.2#> 16 020700100204 18 46.1 46.2#> # ℹ 22 more variables: assessedCatchmentAreaSqMi <dbl>,#> # assessedCatchmentAreaPercent <dbl>, assessedGoodCatchmentAreaSqMi <int>,#> # assessedGoodCatchmentAreaPercent <int>,#> # assessedUnknownCatchmentAreaSqMi <int>,#> # assessedUnknownCatchmentAreaPercent <int>,#> # containImpairedWatersCatchmentAreaSqMi <dbl>,#> # containImpairedWatersCatchmentAreaPercent <dbl>, …tidyr::unnest(df, items) |> tidyr::unnest(summaryRestorationPlans, names_repair = "minimal")#> # A tibble: 1 × 26#> huc12 assessmentUnitCount totalCatchmentAreaSqMi totalHucAreaSqMi#> <chr> <int> <dbl> <dbl>#> 1 020700100204 18 46.1 46.2#> # ℹ 22 more variables: assessedCatchmentAreaSqMi <dbl>,#> # assessedCatchmentAreaPercent <dbl>, assessedGoodCatchmentAreaSqMi <int>,#> # assessedGoodCatchmentAreaPercent <int>,#> # assessedUnknownCatchmentAreaSqMi <int>,#> # assessedUnknownCatchmentAreaPercent <int>,#> # containImpairedWatersCatchmentAreaSqMi <dbl>,#> # containImpairedWatersCatchmentAreaPercent <dbl>, …Find statistical surveys completed by an organization:
surveys(organization_id = "SDDENR", .unnest = TRUE)#> Unable to further unnest data, check for nested dataframes.#> $count#> # A tibble: 1 × 1#> count#> <int>#> 1 5#> #> $items#> # A tibble: 5 × 14#> organizationIdentifier organizationName organizationTypeText surveyStatusCode#> <chr> <chr> <chr> <chr> #> 1 SDDENR South Dakota State Final #> 2 SDDENR South Dakota State Final #> 3 SDDENR South Dakota State Final #> 4 SDDENR South Dakota State Final #> 5 SDDENR South Dakota State Final #> # ℹ 10 more variables: year <int>, surveyCommentText <lgl>, documents <list>,#> # waterTypeGroupCode <chr>, subPopulationCode <chr>, unitCode <chr>,#> # size <int>, siteNumber <int>, surveyWaterGroupCommentText <chr>,#> # surveyWaterGroupUseParameters <list>If you use this package in a publication, please cite as:
citation("rATTAINS")#> To cite rATTAINS in publications use:#> #> Schramm, Michael (2021). rATTAINS: Access EPA 'ATTAINS' Data. R#> package version 1.0.1 doi:10.5281/zenodo.5469911#> https://CRAN.R-project.org/package=rATTAINS#> #> A BibTeX entry for LaTeX users is#> #> @Manual{,#> title = {{rATTAINS}: Access EPA 'ATTAINS' Data},#> author = {Michael Schramm},#> year = {2025},#> url = {https://CRAN.R-project.org/package=rATTAINS},#> doi = {10.5281/zenodo.5469911},#> note = {R package version 1.0.1},#> }About
💧 Access EPA ATTAINS data in R 💧
Topics
Resources
License
Unknown, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.