ropensci / nomisr

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

Issue with nome_get_data #15

Closed mriyayi closed 5 years ago

mriyayi commented 5 years ago

Hi I'm getting the following error. It was working before.... The other functions work i.e. get_metadata. Is it an issue with the API itself?

jobseekers_country <- nomis_get_data(id = "NM_1_1", time = "latest", geography = "TYPE499", measures = c(20100, 20201), sex = 5)

Nomis API did not return data in required CSV format

evanodell commented 5 years ago

I can't reproduce the error on my end, it is likely an issue with the API itself. I'm not aware of any schedule maintenance by Nomis but try it again in a few minutes and see what happens.

mriyayi commented 5 years ago

Hi the issue is linked to the api key. I tried nomis_api_key(check_env = FALSE) and entered the private api key from the nomis website after registration. I then executed the nomis_get_data function and it ceased working. When I execute nomis_api_key(check_env = TRUE) and enter the private api key I get the following error- Warning message: In nomis_api_key(check_env = TRUE) : Couldn't find environment variable 'NOMIS_API_KEY' What am I doing wrong?

evanodell commented 5 years ago

Try setting an environmental variable of 'NOMIS_API_KEY' in the .Renviron file (I use usethis::edit_r_environ() as a shortcut). Also check what happens if you try the query without the API key, for the example you gave above you don't need a key. Restart your R session and try again.