rnassqs (version 0.5.0)

nassqs: Get data and return a data frame

Description

The primary function in the rnassqs package, nassqs makes a HTTP GET request to the USDA-NASS Quick Stats API and returns the data parsed as a data.frame, plain text, or list. Various other functions make use of nassqs to make specific queries. For a data request the Quick Stats API returns JSON that when parsed to a data.frame contains 39 columns and a varying number of rows depending on the query. Unfortunately there is not a way to restrict the number of columns.

Usage

nassqs(..., as = c("data.frame", "text", "list"))

Arguments

...

either a named list of parameters or a series of parameters to form the query

as

whether to return a data.frame, list, or text string nassqs_GET()

Value

a data frame, list, or text string of requested data.

See Also

nassqs_GET(), nassqs_yields(), nassqs_acres()

Examples

Run this code
# NOT RUN {
  # Get corn yields in Virginia in 2012
  params <- list(commodity_name = "CORN",
                 year = 2012,
                 agg_level_desc = "COUNTY",
                 state_alpha = "VA",
                 statisticcat_desc = "YIELD")
  yields <- nassqs(params)
  head(yields)
# }

Run the code above in your browser using DataCamp Workspace