Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get national level data #37

Closed
dwd62 opened this issue Jan 24, 2024 · 2 comments
Closed

Cannot get national level data #37

dwd62 opened this issue Jan 24, 2024 · 2 comments

Comments

@dwd62
Copy link

dwd62 commented Jan 24, 2024

I've been trying into get national level data from the NASS for livestock, poultry, and specialty animals. I've been able to get the state and county aggregated data just fine, but the national level data will show that there are zero records and when I make a request regardless there is an error
I've provided an example below from the rnassqs vignette example.

Specify the query parameters

params <- list(
commodity_desc = "OPERATORS",
domain_desc = "AREA OPERATED",
agg_level_desc = "NATIONAL",
state_alpha = "OR",
year = 2012
)

api_key<-"14E99758-813A-3976-B5FE-DAB3689E1E25"
Sys.setenv(NASSQS_TOKEN = api_key)
nass_set_key("14E99758-813A-3976-B5FE-DAB3689E1E25")

Check that our record request is under the 50,000 limit

nassqs_record_count(params)

#> nassqs_record_count(params)
#|==============================================================================================#=================================| 100%
#$count
#[1] 0

#$Value
#numeric(0)

Get the data

d <- nassqs(params)

#Error: HTTP Failure: 400
#bad request - invalid query

Does anyone have an idea what is happening here?

@potterzot
Copy link
Collaborator

It looks like you are including state_alpha = "OR" in your parameters when querying national data. As you can imagine there is no national level data for Oregon! If I remove that I am able to successfully query 54 records.

@dwd62
Copy link
Author

dwd62 commented Jan 25, 2024

@potterzot thanks! I didn't know that specifying the states would supersede also grabbing national level data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants