Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

💧 Access EPA ATTAINS data in R 💧

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

mps9506/rATTAINS

Repository files navigation

CRAN statusrATTAINS status badgeProject Status: Active – The project has reached a stable, usable state and is being actively developed.R-CMD-checkcodecovDOI

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')

Functions and webservices

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.

Examples:

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>

Citation

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

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp