ropensci / nomisr

Access UK official statistics from the Nomis database through R.
https://docs.ropensci.org/nomisr
Other
44 stars 12 forks source link

nomis_get_data appears to have stopped working #31

Closed AlexStead closed 2 years ago

AlexStead commented 2 years ago

nomis_get_data() was previously working fine for me but now throws up an error message. E.g.

nomis_get_data(id = "NM_893_1", time = "latest", geography = "TYPE266")

Recently, no problem when I run this. But now I get an error message (below). I've tried different requests to no avail.

Other commands (e.g. nomis_get_metadata appear to be working so this appears to be a bug rather than an issue with the API.


It is likely that you have been automatically rate limited by the Nomis API.
You can make smaller data requests, or try again later.

Here's the original error message:
Error in readr::read_csv(x, locale = readr::locale(encoding = encoding), : unused argument (show_col_types = FALSE)

Error: $ operator is invalid for atomic vectors```
evanodell commented 2 years ago

I can't reproduce the error. Have you been making a lot of calls to Nomis? It does rate limit, although the limit is not transparent.

AlexStead commented 2 years ago

After successfully trying out the same command elsewhere, it does seem to be rate limiting.

But this is odd, as I haven't made any calls to Nomis for a couple of months, at least. December-January I was making lots.

Have you encountered this before? How long before the rate limiting is ended?

owenjonesuob commented 2 years ago

tl;dr: try updating {readr} and have another go!


From the error message which {nomisr} helpfully shows us, it seems like the problem might be something to do with an argument called show_col_types, within a call to readr::read_csv(), which happens... somewhere. Not sure yet. Let's dig into what {nomisr} is doing behind the scenes:

@evanodell for this reason it might be worth adding readr >= 2.1.2 to {nomisr}'s DESCRIPTION file, even though it's not used directly. Or alternatively, checking the installed version of {readr} and passing the version-appropriate silencing arg via ....

I'm guessing the different environments you were using @AlexStead had different versions of {readr} installed, one of which must have been older. Hopefully the possible rate limiting was a red herring!

evanodell commented 2 years ago

@owenjonesuob Good find, I'll update that shortly.

evanodell commented 2 years ago

Fixed in https://github.com/ropensci/nomisr/commit/2086995e063af1303c6e92d3bcafbbd57352b1f7