Skip to content

Commit

Permalink
remove dplyr::bind_cols from aqs function, use simplifyDataFrame in h…
Browse files Browse the repository at this point in the history
…ttr2::resp_body_json instead
  • Loading branch information
mccroweyclinton-EPA committed Oct 23, 2023
1 parent 245c302 commit 59a7956
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions MD5
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ f41ed996be135fb35afe00641621da61 *man/figures/lifecycle-questioning.svg
ed42e3fbd7cc30bc6ca8fa9b658e24a8 *man/figures/lifecycle-stable.svg
bf2f1ad432ecccee3400afe533404113 *man/figures/lifecycle-superseded.svg
7ce4525010156c02adaf819a8c835134 *man/RAQSAPI.Rd
de6522fbf913a3ddaca65ee3cc97dff5 *NAMESPACE
cba75186037b95121bfe7eeca1a1159d *NAMESPACE
94c65e3824d4fd9ffa90ec73fed63596 *NEWS.md
06cc87b389ac65abf2b066ac57662977 *R/AQSAPI_helperfunctions.R
3c620bae37a1c14a9539ac3665a3130e *R/AQSAPI_helperfunctions.R
a3558975d0256839b174ab7868833075 *R/bybox.R
bd8b36cc7325d4fc8b8ed894f0046678 *R/bycbsa.R
253ea551f88c65c1c49feff3cb33f552 *R/bycounty.R
Expand Down Expand Up @@ -403,7 +403,7 @@ f7ea691da1baf266047ed7af4b0c4629 *RAQSAPI.Rcheck/tests/testthat/test-bypqao.R
3e2e78ef3cf7666c3c041ff1b5bec788 *RAQSAPI.Rcheck/tests/testthat/testthat-problems.rds
a69de5455537022556f014579766be59 *RAQSAPI.Rproj
cfb9487651a3162cdb4308fb94e30719 *RAQSAPI_2.0.5.tar.gz
e83f8a2cbe3da548bdb162e86d33e90c *README.md
2ebf9afc2ea031d85d67ba4d3da009b4 *README.md
10f9e33622104f2df281fb4119a09d36 *README.Rmd
7ed08f3fb96a77ec01c95c2ad7964250 *revdep/data.sqlite
34952a5944548ea4fc132a9899f8e6ab *revdep/email.yml
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export(aqs_transactionsample_by_site)
export(aqs_transactionsample_by_state)
importFrom(dplyr,arrange)
importFrom(dplyr,between)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(dplyr,mutate)
importFrom(dplyr,rename)
Expand Down
20 changes: 9 additions & 11 deletions R/AQSAPI_helperfunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ format_multiple_params_for_api <- function(x, separator=",")
#' @param AQS_domain a R string object containing the domain that should be
#' used in constructing the API call.
#' @importFrom magrittr `%<>%` `%>%`
#' @importFrom dplyr mutate select arrange bind_cols
#' @importFrom dplyr mutate select arrange
#' @importFrom lubridate ymd_hm
#' @importFrom glue glue
#' @importFrom tibble as_tibble
Expand Down Expand Up @@ -380,20 +380,18 @@ aqs <- function(service, filter = NULL, user = NA,
variables))) %>%
request() %>%
req_throttle(rate = 10/60, realm = "RAQSAPI") %>%
req_retry(max_tries = 5, max_seconds = 7, backoff = ~10)
req_retry(max_tries = 5, max_seconds = 30, backoff = ~10)
#%>%#causes issues
#req_user_agent(string = user_agent)

AQStemp <- AQSpath %>%
req_perform(verbosity = 0) %>%
resp_body_json()
AQStemp <- AQSpath %>%
req_perform(verbosity = 0) %>%
resp_body_json(simplifyVector = TRUE,
simplifyDataFrame = TRUE) %>%
as.tibble()
AQSresult <- vector("list", length = 2)
AQSresult[[1]] <- AQStemp$Header %>%
bind_cols() %>%
suppressMessages()
AQSresult[[2]] <- AQStemp$Data %>%
bind_cols() %>%
suppressMessages()
AQSresult[[1]] <- AQStemp$Header
AQSresult[[2]] <- AQStemp$Data
names(AQSresult) <- c("Header", "Data")
AQSresult <- structure(.Data = AQSresult, class = "AQS_DATAMART_APIv2")
#aqs_ratelimit()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ status](https://www.r-pkg.org/badges/version/RAQSAPI)](https://CRAN.R-project.or
downloads](https://cranlogs.r-pkg.org/badges/RAQSAPI)](https://cran.r-project.org/package=RAQSAPI)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![license](https://img.shields.io/badge/license-CC0-lightgrey.svg)](https://choosealicense.com/)
[![Last-changedate](https://img.shields.io/badge/last%20change-%202023--10--05-yellowgreen.svg)](/commits/master)
[![Last-changedate](https://img.shields.io/badge/last%20change-%202023--10--23-yellowgreen.svg)](/commits/master)
<!-- badges: end -->

# EPA Disclaimer
Expand Down

0 comments on commit 59a7956

Please sign in to comment.