- Notifications
You must be signed in to change notification settings - Fork7
An interface to USDA Quick Stats data with mapping capabilities.
License
bradlindblad/tidyUSDA
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
tidyUSDA, an interface to USDA Quick Stats data with mapping capabilities.
tidyUSDA provides the R user with a consistent API to pull USDA census and survey data from Quickstats.
getQuickstat()lets you pass values to the fields you see on the QuickStats website, as well as include a simple features (SF) geometry field for the county or state level.View({parameter name})lets you view QuickStats all available values for a given field (which you would input into getQuickstats(), preferably with copy paste)plotUSDA()provides a quick way to plot your data if you set geometry = TRUE
# Install directly from CRAN:install.packages("tidyUSDA")Depending on which operating system you are installing tidyUSDA on, you may need to add external dependencies.
Please see the 'Installation' section on thesf package homepage for details.
Check out the vignette with:
vignette("using_tidyusda")You first need to grab a free API token from the USDA at their Quickstats website.
library(tidyUSDA)# Save your API token to a variable, or better yet, use the keyring package to store it securelykey <- '1234-abcd'# View all parameter names for the 'program' fieldView(tidyUSDA::allProgram)# Get count of operations with sales in 2017ops.with.sales <- tidyUSDA::getQuickstat( sector=NULL, group=NULL, commodity=NULL, category=NULL, domain=NULL, county=NULL, key = key, program = 'CENSUS', data_item = 'CROP TOTALS - OPERATIONS WITH SALES', geographic_level = 'COUNTY', year = '2017', state = NULL, geometry = T, lower48 = T)# Plot this data for each statetidyUSDA::plotUSDA(df = ops.with.sales)The last function returns this ggplot choropleth:
This product uses the NASS API but is not endorsed or certified by NASS.
About
An interface to USDA Quick Stats data with mapping capabilities.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
