Git Product home page Git Product logo

rattains's Introduction

rATTAINS

CRAN status rATTAINS status badge Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check codecov DOI

rATTAINS provides functions for downloading tidy data from the United States (U.S.) Environmental Protection Agency (EPA) ATTAINS webservice. ATTAINS is the online system used to track and report Clean Water Act assessments and Total Maximum Daily Loads (TMDLs) in U.S. surface waters. rATTAINS facilitates access to the public information webservice made 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 first eight web services detailed by EPA. All arguments are case sensitive. By default the functions attempt to provide flattened “tidy” data as a single or multiple dataframes. By using the tidy = FALSE argument in the function below, the raw JSON will be read into the session for the user to parse if desired. This can be useful since some webservices provide different results based on the query and the tidying process used in rATTAINS might make poor assumptions in the data flattening process. If the function returns unexpected results, try parsing the raw JSON string.

  • state_summary() provides summary information for assessed uses for organizations 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 particular finalized actions (TMDLs and related).

  • assessments() provides summary data about the specified assessment decisions by waterbody.

  • plans() returns a summary of the plans (TMDLs and related) within a specified HUC.

  • domain_values() returns allowed values in ATTAINS. By default (no arguments) the function returns a list of allowed domain_names.

  • assessment_units() returns a summary of information about the specified assessment units.

  • surveys() returns results from state statistical survey results in ATTAINS.

Examples:

Get a summary about assessed uses from the Texas Commission on Environmental Quality:

library(rATTAINS)
state_summary(organization_id = "TCEQMAIN", 
              reporting_cycle = "2020",
              .unnest = FALSE) |>
  tidyr::unnest(reporting_cycles) |> 
  tidyr::unnest(water_types) |> 
  tidyr::unnest(use_attainments)
#> # A tibble: 31 × 16
#>    organization_identifer organization_name organization_type_text
#>    <chr>                  <chr>             <chr>                 
#>  1 TCEQMAIN               Texas             State                 
#>  2 TCEQMAIN               Texas             State                 
#>  3 TCEQMAIN               Texas             State                 
#>  4 TCEQMAIN               Texas             State                 
#>  5 TCEQMAIN               Texas             State                 
#>  6 TCEQMAIN               Texas             State                 
#>  7 TCEQMAIN               Texas             State                 
#>  8 TCEQMAIN               Texas             State                 
#>  9 TCEQMAIN               Texas             State                 
#> 10 TCEQMAIN               Texas             State                 
#> # ℹ 21 more rows
#> # ℹ 13 more variables: reporting_cycle <chr>, water_type_code <chr>,
#> #   units_code <chr>, use_name <chr>, fully_supporting <dbl>,
#> #   fully_supporting_count <int>, use_insufficient_information <dbl>,
#> #   use_insufficient_information_count <int>, not_assessed <dbl>,
#> #   not_assessed_count <int>, not_supporting <dbl>, not_supporting_count <int>,
#> #   parameters <list<tibble[,9]>>

Get a summary about assessed uses, parameters and plans in a HUC12:

df <- huc12_summary(huc = "020700100204",
              .unnest = FALSE)

tidyr::unnest(df, summary_by_use)
#> # A tibble: 5 × 24
#>   huc12        assessment_unit_count total_catchment_area…¹ total_huc_area_sq_mi
#>   <chr>                        <int>                  <dbl>                <dbl>
#> 1 020700100204                    17                   46.1                 46.2
#> 2 020700100204                    17                   46.1                 46.2
#> 3 020700100204                    17                   46.1                 46.2
#> 4 020700100204                    17                   46.1                 46.2
#> 5 020700100204                    17                   46.1                 46.2
#> # ℹ abbreviated name: ¹​total_catchment_area_sq_mi
#> # ℹ 20 more variables: assessed_catchment_area_sq_mi <dbl>,
#> #   assessed_cathcment_area_percent <dbl>,
#> #   assessed_good_catchment_area_sq_mi <dbl>,
#> #   assessed_good_catchment_area_percent <dbl>,
#> #   assessed_unknown_catchment_area_sq_mi <dbl>,
#> #   assessed_unknown_catchment_area_percent <dbl>, …

tidyr::unnest(df, summary_by_parameter_impairments, names_repair = "minimal")
#> # A tibble: 16 × 25
#>    huc12       assessment_unit_count total_catchment_area…¹ total_huc_area_sq_mi
#>    <chr>                       <int>                  <dbl>                <dbl>
#>  1 0207001002…                    17                   46.1                 46.2
#>  2 0207001002…                    17                   46.1                 46.2
#>  3 0207001002…                    17                   46.1                 46.2
#>  4 0207001002…                    17                   46.1                 46.2
#>  5 0207001002…                    17                   46.1                 46.2
#>  6 0207001002…                    17                   46.1                 46.2
#>  7 0207001002…                    17                   46.1                 46.2
#>  8 0207001002…                    17                   46.1                 46.2
#>  9 0207001002…                    17                   46.1                 46.2
#> 10 0207001002…                    17                   46.1                 46.2
#> 11 0207001002…                    17                   46.1                 46.2
#> 12 0207001002…                    17                   46.1                 46.2
#> 13 0207001002…                    17                   46.1                 46.2
#> 14 0207001002…                    17                   46.1                 46.2
#> 15 0207001002…                    17                   46.1                 46.2
#> 16 0207001002…                    17                   46.1                 46.2
#> # ℹ abbreviated name: ¹​total_catchment_area_sq_mi
#> # ℹ 21 more variables: assessed_catchment_area_sq_mi <dbl>,
#> #   assessed_cathcment_area_percent <dbl>,
#> #   assessed_good_catchment_area_sq_mi <dbl>,
#> #   assessed_good_catchment_area_percent <dbl>,
#> #   assessed_unknown_catchment_area_sq_mi <dbl>,
#> #   assessed_unknown_catchment_area_percent <dbl>, …

tidyr::unnest(df, summary_restoration_plans, names_repair = "minimal")
#> # A tibble: 1 × 25
#>   huc12        assessment_unit_count total_catchment_area…¹ total_huc_area_sq_mi
#>   <chr>                        <int>                  <dbl>                <dbl>
#> 1 020700100204                    17                   46.1                 46.2
#> # ℹ abbreviated name: ¹​total_catchment_area_sq_mi
#> # ℹ 21 more variables: assessed_catchment_area_sq_mi <dbl>,
#> #   assessed_cathcment_area_percent <dbl>,
#> #   assessed_good_catchment_area_sq_mi <dbl>,
#> #   assessed_good_catchment_area_percent <dbl>,
#> #   assessed_unknown_catchment_area_sq_mi <dbl>,
#> #   assessed_unknown_catchment_area_percent <dbl>, …

Find statistical surveys completed by an organization:

surveys(organization_id="SDDENR",
        .unnest = FALSE) |> 
  tidyr::unnest(survey_water_groups) |> 
  tidyr::unnest(survey_water_group_use_parameters)
#> # A tibble: 104 × 21
#>    organization_identifier organization_name organization_type_text
#>    <chr>                   <chr>             <chr>                 
#>  1 SDDENR                  South Dakota      State                 
#>  2 SDDENR                  South Dakota      State                 
#>  3 SDDENR                  South Dakota      State                 
#>  4 SDDENR                  South Dakota      State                 
#>  5 SDDENR                  South Dakota      State                 
#>  6 SDDENR                  South Dakota      State                 
#>  7 SDDENR                  South Dakota      State                 
#>  8 SDDENR                  South Dakota      State                 
#>  9 SDDENR                  South Dakota      State                 
#> 10 SDDENR                  South Dakota      State                 
#> # ℹ 94 more rows
#> # ℹ 18 more variables: survey_status_code <chr>, year <int>,
#> #   survey_comment_text <chr>, documents <list<tibble[,8]>>,
#> #   water_type_group_code <chr>, sub_population_code <chr>, unit_code <chr>,
#> #   size <int>, site_number <int>, surey_water_group_comment_text <chr>,
#> #   stressor <chr>, survey_use_code <chr>, survey_category_code <chr>,
#> #   statistic <chr>, metric_value <dbl>, margin_of_error <dbl>, …

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.0. 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 = {2021},
#>     url = {https://CRAN.R-project.org/package=rATTAINS},
#>     doi = {10.5281/zenodo.5469911},
#>     note = {R package version 1.0.0},
#>   }

rattains's People

Contributors

hadley avatar mps9506 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hadley

rattains's Issues

Empty folders created

The empty folders created by the caching logic are not allowed by CRAN.

Not 100% sure why this doesn't trigger the other Checks, but possibly try with:
_R_CHECK_DONTTEST_EXAMPLES_=true

Tasks for v1.0 releases

  • remove tidyjson dependency, switch to tibblify to ensure consistent data structures are returned.
  • eliminate magrittr import/export
  • update docs
  • update pkgdown examples (add example for parsing json manually if errors occur)
  • update mocked tests
  • remove janitor dependency
  • add argument for returning nested data (see #33 )
  • update citation file

Release rATTAINS 0.1.4

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check()
  • Update citation version
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • Wait for purrr 1.0.1
  • tidyjson release?
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push

CRAN check errors

Errors on r-devel-linux-x86_64-debian-gcc, r-release-macos-x86_64, r-oldrel-macos-x86_64 during CRAN checks.

Flavor: r-devel-linux-x86_64-debian-gcc:

Version: 0.1.0
Check: tests
Result: ERROR
     Running ‘testthat.R’ [10s/15s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(rATTAINS)
     >
     > test_check("rATTAINS")
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/actions/R8-ND-2018-03_N_Nactions.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/assessmentUnits/AL03150201-0107-200assessmentUnits.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/assessmentUnits/AL03150201-0107-200assessmentUnits.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/assessments/SDDENR_GRAZING_IN_RIPARIAN_OR_SHORELINE_ZONES_N_Nassessments.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/assessments/SDDENR_GRAZING_IN_RIPARIAN_OR_SHORELINE_ZONES_N_Nassessments.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/huc12summary/020700100204huc12.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/huc12summary/020700100204huc12.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/plans/020700100103_Nplans.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/plans/020700100103_Nplans.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/usesStateSummary/TDECWR_2016state_summary.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/usesStateSummary/TDECWR_2016state_summary.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/surveys/SDDENRsurveys.json
     reading cached file from: /tmp/check-CRAN-regular-hornik/cache/R/attains-public/api/surveys/SDDENRsurveys.json
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test-actions.R:3:3): actions webservice works ────────────────────────
     Error: Column `agencyCode` not found in `.data`
     Backtrace:
     █
     1. ├─vcr::use_cassette(...) test-actions.R:3:2
     2. │ └─cassette$call_block(...)
     3. ├─rATTAINS::actions(action_id = "R8-ND-2018-03") test-actions.R:4:4
     4. │ └─rATTAINS:::actions_to_tibble(...)
     5. │ └─`%>%`(...)
     6. ├─janitor::clean_names(.)
     7. ├─tibble::as_tibble(.)
     8. ├─dplyr::select(., -c(.data$array.index))
     9. ├─tidyjson::spread_all(., recursive = TRUE)
     10. │ └─tidyjson::is.tbl_json(.x)
     11. ├─tidyjson::gather_array(.)
     12. │ ├─assertthat::assert_that(!("..name" %in% names(.x)))
     13. │ │ └─assertthat::see_if(..., env = env, msg = msg)
     14. │ │ ├─base::tryCatch(...)
     15. │ │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
     16. │ │ │ └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
     17. │ │ │ └─base:::doTryCatch(return(expr), name, parentenv, handler)
     18. │ │ └─base::eval(assertion, env)
     19. │ │ └─base::eval(assertion, env)
     20. │ └─"..name" %in% names(.x)
     21. ├─tidyjson::enter_object(., "documentTypes")
     22. │ └─tidyjson::is.tbl_json(.x)
     23. ├─dplyr::select(., -c(.data$array.index))
     24. ├─tidyjson::spread_all(.)
     25. │ └─tidyjson::is.tbl_json(.x)
     26. ├─tidyjson::gather_array(.)
     27. │ ├─assertthat::assert_that(!("..name" %in% names(.x)))
     28. │ │ └─assertthat::see_if(..., env = env, msg = msg)
     29. │ │ ├─base::tryCatch(...)
     30. │ │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
     31. │ │ │ └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
     32. │ │ │ └─base:::doTryCatch(return(expr), name, parentenv, handler)
     33. │ │ └─base::eval(assertion, env)
     34. │ │ └─base::eval(assertion, env)
     35. │ └─"..name" %in% names(.x)
     36. ├─tidyjson::enter_object(., "documents")
     37. │ └─tidyjson::is.tbl_json(.x)
     38. ├─dplyr::rename(., agencyCode_1 = .data$agencyCode)
     39. ├─dplyr:::rename.data.frame(., agencyCode_1 = .data$agencyCode)
     40. │ └─tidyselect::eval_rename(expr(c(...)), .data)
     41. │ └─tidyselect:::rename_impl(...)
     42. │ └─tidyselect:::eval_select_impl(...)
     43. │ ├─tidyselect:::with_subscript_errors(...)
     44. │ │ ├─base::tryCatch(...)
     45. │ │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
     46. │ │ │ └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
     47. │ │ │ └─base:::doTryCatch(return(expr), name, parentenv, handler)
     48. │ │ └─tidyselect:::instrument_base_errors(expr)
     49. │ │ └─base::withCallingHandlers(...)
     50. │ └─tidyselect:::vars_select_eval(...)
     51. │ └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
     52. │ └─tidyselect:::eval_c(expr, data_mask, context_mask)
     53. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
     54. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
     55. │ └─base::eval(expr, data_mask)
     56. │ └─base::eval(expr, data_mask)
     57. │ ├─agencyCode
     58. │ └─rlang:::`$.rlang_data_pronoun`(.data, agencyCode)
     59. │ └─rlang:::data_pronoun_get(x, nm)
     60. └─rlang:::abort_data_pronoun(x)
    
     [ FAIL 1 | WARN 0 | SKIP 0 | PASS 43 ]
     Error: Test failures
     Execution halted

Flavors: r-release-macos-x86_64, r-oldrel-macos-x86_64

Version: 0.1.0
Check: tests
Result: ERROR
     Running ‘testthat.R’ [3s/3s]
    Running the tests in ‘tests/testthat.R’ failed.
    Last 13 lines of output:
     42. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
     43. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
     44. │ └─tidyselect:::eval_c(expr, data_mask, context_mask)
     45. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
     46. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask)
     47. │ └─base::eval(expr, data_mask)
     48. │ └─base::eval(expr, data_mask)
     49. │ ├─agencyCode
     50. │ └─rlang:::`$.rlang_data_pronoun`(.data, agencyCode)
     51. │ └─rlang:::data_pronoun_get(x, nm)
     52. └─rlang:::abort_data_pronoun(x)
    
     [ FAIL 2 | WARN 0 | SKIP 0 | PASS 39 ]
     Error: Test failures
     Execution halted

Flavors: r-release-macos-x86_64, r-oldrel-macos-x86_64

Version: 0.1.0
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
     ...
    --- re-building ‘Introduction.Rmd’ using rmarkdown
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) not available. Falling back to R Markdown v1.
    reading cached file from: ~/Library/Caches/R/attains-public/api/usesStateSummary/TDECWR_2016state_summary.json
    Quitting from lines 60-61 (Introduction.Rmd)
    Error: processing vignette 'Introduction.Rmd' failed with diagnostics:
    subscript out of bounds
    --- failed re-building ‘Introduction.Rmd’
    
    SUMMARY: processing the following file failed:
     ‘Introduction.Rmd’
    
    Error: Vignette re-building failed.
    Execution halted

Arguments to assessments function cause error

Hello,

I am hoping to use this package to query the ATTAINS data for specific areas across the eastern United States. I think most of the data I'm interested in is in the use_assessment tibble produced by assessments(), but I'm having difficulty using the assessments() function with assessment_unit_id designated. I would also like to know EPA IR categories since ~2010, which I think means I'll need to run assessments() multiple times, as shown in your example tutorial (though at the state level).

I can only get the assessments() function to complete a query with an assessment_unit_id listed when both state_code and organization_id are also listed. Is this the expected function? I also run into an error when I try to specify any reporting cycle other than 2020 (which I think is the most recent one based on the default arguments). Adding any agency_code arguments doesn't affect the error.

assessments(assessment_unit_id='KY-1749', state_code='KY', organization_id='21KY') # works assessments(assessment_unit_id='KY-1749', state_code='KY', organization_id='21KY', reporting_cycle='2020') # works assessments(assessment_unit_id='KY-1749', state_code='KY', organization_id='21KY', reporting_cycle='2016') # does not work

The error I recieve is : "Error in dplyr::select():
! Can't subset columns that don't exist.
x Column agencyCode doesn't exist.
Run rlang::last_error() to see where the error occurred. "
I downloaded the CRAN version of the package this morning and am running R version 4.1.1 on Windows.

I appreciate your help with this issue and for writing this package! It is going to immensely help and speed up the process -- we have about 70 sites across 13 states. Thanks!
Traci

Release rATTAINS 0.1.2

Prepare for release:

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Release rATTAINS 0.1.0

First release:

Prepare for release:

  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Review pkgdown reference index for, e.g., missing topics
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Update install instructions in README
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Broken Test

Warning message:
package 'testthat' was built under R version 4.2.2 
[ FAIL 0 | WARN 1 | SKIP 0 | PASS 53 ]

══ Warnings ════════════════════════════════════════════════════════════════════
── Warning ('test-plans.R:3'): plans works ─────────────────────────────────────
array.index column name already exists, changing to array.index.2
Backtrace:
  1. vcr::use_cassette(...)
       at test-plans.R:3:2
 11. tidyjson::gather_array(.)

[ FAIL 0 | WARN 1 | SKIP 0 | PASS 53 ]
Warning message:
package 'vcr' was built under R version 4.2.2 

Tests complete

Error with state_summary() tidy = TRUE

Hi -- I'm interested in exploring EPA ATTAINS records for multiple states in the Northeast US.


## R version 4.1.0
library(rATTAINS) ## 0.1.3.9999
library(dplyr) ## 1.0.7

domain_values(domain_name = "OrgStateCode") %>%
  filter(code %in% c("RI")) %>%
  pull(context)
## [1] "RIDEM" "EPA"  

state_summary(organization_id = "RIDEM") 
## Error: Can't coerce element 10 from a list to a character

## Whereas, when the code is not tidy it returns data
head(state_summary(organization_id = "RIDEM", tidy = FALSE))

Please let me know if you need additional information to make sure the code above is reproducible.

Release rATTAINS 0.1.3

Prepare for release:

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Release rATTAINS 1.0.0

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • Polish NEWS
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • Update cran-comments.md
  • git push
  • Wait for curl check errors to ressolve

Submit to CRAN:

  • usethis::use_version('major')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • git push

Remove caching?

CRAN seems to have a moving policy on allowing package to write to user directories, or at least where packages can write to.

Suggest removing caching functions and including documentation for users to cache api calls themselves.

Test Failure on CRAN

Getting the following test failure on CRAN

checking tests ... [17s/44s] ERROR
  Running ‘testthat.R’ [17s/43s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(rATTAINS)
  >
  > test_check("rATTAINS")
  no files found
  no files found
  no files found
  no files found
  no files found
  no files found
  no files found
  no files found
  ══ Skipped tests ═══════════════════════════════════════════════════════════════
  • On CRAN (6)
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error (test-huc12_summary.R:14:3): huc_12 works ─────────────────────────────
  Error in `curl::curl_fetch_memory(x$url$url, handle = x$url$handle)`: Timeout was reached: [attains.epa.gov] Operation timed out after 10001 milliseconds with 0 out of 0 bytes received
  Backtrace:
      █
   1. └─rATTAINS::huc12_summary(huc = "020700100204", tidy = FALSE) test-huc12_summary.R:14:2
   2. └─rATTAINS:::xGET(path, args, file = NULL, ...)
   3. └─cli$get(path = path, query = args)
   4. └─private$make_request(rr)
   5. └─crul:::crul_fetch(opts)
   6. └─curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  [ FAIL 1 | WARN 0 | SKIP 6 | PASS 38 ]
  Error: Test failures
  Execution halted

This is odd because {vcr} is used and the tests should be returning the information in the cassettes. We aren't actually making external internet calls in the test. This works locally if I don't have an internet connection.
Further, the information returned in the error message is deemed unhelpful by CRAN so in this error case they want improved error messaging. Even with an informative error message, the test would have failed.

leave data nested? [possible breaking change]

Switching to tibblify in the dev version facilitates returning consistent data structures from the API regardless of missing data returned by EPA's API. My initial design choice was to return data as unnested as possible, thinking it is easier for users to avoid unnest operations. tidyr's unnest(), unnest_wider(), unnest_longer(), probably makes it much easier for new users to unnest data now.

It is much harder to go the other direction (nesting data) without knowing what variables to group by however! Currently working on a project where I only want the high level data (nested grouped variables) and it is very much a pain to remember what variables to group by.

Options:

  • leave as is
  • return nested data
  • add argument to return nested data (default would be to keep current behavior)

Release rATTAINS 0.1.1

Prepare for release:

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • usethis::use_github_release()
  • usethis::use_dev_version()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.