tidyUSDA, an interface to USDA Quick Stats data with mapping capabilities.

Overview

tidyUSDA provides the R user with a consistent API to pull USDA census and survey data from QuickStats. You can:

  • 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

Installation

# Install directly from CRAN:
install.packages("tidyUSDA")

Windows

Depending on which version of R you have installed, you may need to install Rtools.

Mac

You may need to install gdal before install.packages(“tidyUSDA”). Use these commands:

brew install pkg-config     
brew install gdal

Linux

You will need to install GDAL (>= 2.0.1), GEOS (>= 3.4.0) and Proj.4 (>= 4.8.0) for most Unix-based systems.

Ubuntu

To install the dependencies on Ubuntu, either add ubuntugis-unstable to the package repositories:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

or install dependencies from source; see e.g. an older travis config file for hints.

Fedora

The following command installs all required dependencies:

sudo dnf install gdal-devel proj-devel proj-epsg proj-nad geos-devel udunits2-devel

Arch

Get gdal, proj and geos from the main repos and udunits from the AUR:

pacman -S gdal proj geos
pacaur/yaourt/whatever -S udunits

Thanks to the SF package README for these OS helpers.

Contact