rnassqs: accessing USDA agricultural data via API

Author: Nicholas Potter

“The United States Deparment of Agriculture National Agricultural Statistics Service (USDA-NASS) provides a wide range of agricultural data that includes animal, crop, demographic, economic, and environmental measures across a number of geographies and time periods. This data is available by direct download or queriable via the Quick Stats interface. While the Quick Stats tool puts a large amount of data into the hands of users, the interface can be frustrating, especially when trying to access more than 50,000 records or hoping to automate downloading data when new data is released. I developed rnassqs as a solution to these frustrations. rnassqs provides a simple R interface for the Quick Stats API. By iterating over a set of parameters, R users can make processing NASS data reproducible and automated.”

In this post, Nicholas Potter works through a real world use case and outlines specific improvements he made to the package and documentation based on reviewers’ comments

Read the full post: https://ropensci.org/blog/2019/11/26/rnassqs/

1 Like

Thank you for this blog. USDA reports released 12pm est, is it possible to use rnassqs package to access numbers immediately? Many data points, but only need 5 of them. Thanks.

@potterzot thoughts on @runner76’s question?

@runner76 whether the data are accessible at 12pm EST depends entirely on when they get added to the Quick Stats database. If they are available via the web interface to quickstats at 12pm EST, then they are also available via the rnassqs interface.

In my experience, the data are added quite quickly, although there is some variation depending on the data product. I would suggesting contacting the USDA staff responsible for the data product you’re interested in to ask whether the data from their publication is available via Quick Stats at the same time as the publication. If it’s an embargoed product I would imagine the answer is yes but better to check.

1 Like