Closed andrewallenbruce closed 7 months ago
xxxx_years()
helperOne call consists of a request/response pair to the API:
utils_years()
: check if the year being requested is availablehttr2
: return the dataMapping with purrr adds another(!) req/res pair to utils_years()
for each year in the iteration.
Two identical calls within 10 secs (to account for any http caching), returning a data.frame with 3,125 rows and 73 columns:
library(provider)
library(tictoc)
tic()
map_dfr(util_years(), ~utilization(year = .x, city = "Valdosta", state = "GA", type = "provider", tidy = FALSE))
toc()
#> 14.41 sec elapsed
#> 8.81 sec elapsed
5.6 second difference [~40% reduction]
affiliations()
Created on 2023-10-18 with reprex v2.0.2