I am trying to query data from the CDC that has >1,000,000 rows of data. I have 2 potential API endpoints I can use, one in CSV and the other in JSON format:
https://data.cdc.gov/resource/jr58-6ysp.json
https://data.cdc.gov/resource/jr58-6ysp.csv
What I need to be able to do is query this data where usa_or_hhsregion == "9"
. I have looked at other API-related questions and cannot figure out what I am doing incorrectly. Here is what I have tried.
- Without attempting any query.
res <- GET("https://data.cdc.gov/resource/jr58-6ysp.json")
test <- fromJSON(rawToChar(res$content))
This produces a data frame of 1000 rows, of which usa_or_hhsregion == "1"
. I read on the CDC’s site they restrict their API to 1000 rows but also read that you are able to expand that restriction (to which I could not find out how).
- Attempting to query.
res <- GET("https://data.cdc.gov/resource/jr58-6ysp.json", query = usa_or_hhsregion == "9")
to which I get…
Error: object 'usa_or_hhsregion' not found
I have no preference on which API to use, as long as I am able to obtain all the data for region 9, then any method/API works.