Skip to content

Commit 59a7956

Browse files
remove dplyr::bind_cols from aqs function, use simplifyDataFrame in httr2::resp_body_json instead
1 parent 245c302 commit 59a7956

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

MD5

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ f41ed996be135fb35afe00641621da61 *man/figures/lifecycle-questioning.svg
117117
ed42e3fbd7cc30bc6ca8fa9b658e24a8 *man/figures/lifecycle-stable.svg
118118
bf2f1ad432ecccee3400afe533404113 *man/figures/lifecycle-superseded.svg
119119
7ce4525010156c02adaf819a8c835134 *man/RAQSAPI.Rd
120-
de6522fbf913a3ddaca65ee3cc97dff5 *NAMESPACE
120+
cba75186037b95121bfe7eeca1a1159d *NAMESPACE
121121
94c65e3824d4fd9ffa90ec73fed63596 *NEWS.md
122-
06cc87b389ac65abf2b066ac57662977 *R/AQSAPI_helperfunctions.R
122+
3c620bae37a1c14a9539ac3665a3130e *R/AQSAPI_helperfunctions.R
123123
a3558975d0256839b174ab7868833075 *R/bybox.R
124124
bd8b36cc7325d4fc8b8ed894f0046678 *R/bycbsa.R
125125
253ea551f88c65c1c49feff3cb33f552 *R/bycounty.R
@@ -403,7 +403,7 @@ f7ea691da1baf266047ed7af4b0c4629 *RAQSAPI.Rcheck/tests/testthat/test-bypqao.R
403403
3e2e78ef3cf7666c3c041ff1b5bec788 *RAQSAPI.Rcheck/tests/testthat/testthat-problems.rds
404404
a69de5455537022556f014579766be59 *RAQSAPI.Rproj
405405
cfb9487651a3162cdb4308fb94e30719 *RAQSAPI_2.0.5.tar.gz
406-
e83f8a2cbe3da548bdb162e86d33e90c *README.md
406+
2ebf9afc2ea031d85d67ba4d3da009b4 *README.md
407407
10f9e33622104f2df281fb4119a09d36 *README.Rmd
408408
7ed08f3fb96a77ec01c95c2ad7964250 *revdep/data.sqlite
409409
34952a5944548ea4fc132a9899f8e6ab *revdep/email.yml

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export(aqs_transactionsample_by_site)
9696
export(aqs_transactionsample_by_state)
9797
importFrom(dplyr,arrange)
9898
importFrom(dplyr,between)
99-
importFrom(dplyr,bind_cols)
10099
importFrom(dplyr,bind_rows)
101100
importFrom(dplyr,mutate)
102101
importFrom(dplyr,rename)

R/AQSAPI_helperfunctions.R

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ format_multiple_params_for_api <- function(x, separator=",")
351351
#' @param AQS_domain a R string object containing the domain that should be
352352
#' used in constructing the API call.
353353
#' @importFrom magrittr `%<>%` `%>%`
354-
#' @importFrom dplyr mutate select arrange bind_cols
354+
#' @importFrom dplyr mutate select arrange
355355
#' @importFrom lubridate ymd_hm
356356
#' @importFrom glue glue
357357
#' @importFrom tibble as_tibble
@@ -380,20 +380,18 @@ aqs <- function(service, filter = NULL, user = NA,
380380
variables))) %>%
381381
request() %>%
382382
req_throttle(rate = 10/60, realm = "RAQSAPI") %>%
383-
req_retry(max_tries = 5, max_seconds = 7, backoff = ~10)
383+
req_retry(max_tries = 5, max_seconds = 30, backoff = ~10)
384384
#%>%#causes issues
385385
#req_user_agent(string = user_agent)
386386

387-
AQStemp <- AQSpath %>%
388-
req_perform(verbosity = 0) %>%
389-
resp_body_json()
387+
AQStemp <- AQSpath %>%
388+
req_perform(verbosity = 0) %>%
389+
resp_body_json(simplifyVector = TRUE,
390+
simplifyDataFrame = TRUE) %>%
391+
as.tibble()
390392
AQSresult <- vector("list", length = 2)
391-
AQSresult[[1]] <- AQStemp$Header %>%
392-
bind_cols() %>%
393-
suppressMessages()
394-
AQSresult[[2]] <- AQStemp$Data %>%
395-
bind_cols() %>%
396-
suppressMessages()
393+
AQSresult[[1]] <- AQStemp$Header
394+
AQSresult[[2]] <- AQStemp$Data
397395
names(AQSresult) <- c("Header", "Data")
398396
AQSresult <- structure(.Data = AQSresult, class = "AQS_DATAMART_APIv2")
399397
#aqs_ratelimit()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ status](https://www.r-pkg.org/badges/version/RAQSAPI)](https://CRAN.R-project.or
3737
downloads](https://cranlogs.r-pkg.org/badges/RAQSAPI)](https://cran.r-project.org/package=RAQSAPI)
3838
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
3939
[![license](https://img.shields.io/badge/license-CC0-lightgrey.svg)](https://choosealicense.com/)
40-
[![Last-changedate](https://img.shields.io/badge/last%20change-%202023--10--05-yellowgreen.svg)](/commits/master)
40+
[![Last-changedate](https://img.shields.io/badge/last%20change-%202023--10--23-yellowgreen.svg)](/commits/master)
4141
<!-- badges: end -->
4242

4343
# EPA Disclaimer

0 commit comments

Comments
 (0)