nassqs_parse | R Documentation |
nassqs_GET()
.Returns a data frame, list, or text string. If a data.frame, all columns
except year
strings because the 'Quick Stats' data returns suppressed data
as '(D)', '(Z)', or other character indicators which mean different things.
Converting the value to a numerical results in NA, which loses that
information.
nassqs_parse(req, as_numeric = TRUE, as = c("data.frame", "list", "text"), ...)
req |
the GET response from |
as_numeric |
whether to convert values to numeric format. |
as |
whether to return a data.frame, list, or text string |
... |
additional parameters passed to |
a data frame, list, or text string of the content from the response.
## Not run: # Set parameters and make the request params <- list(commodity_desc = "CORN", year = 2012, agg_level_desc = "STATE", state_alpha = "WA", statisticcat_desc = "YIELD") response <- nassqs_GET(params) # Parse the response to a data frame corn <- nassqs_parse(response, as = "data.frame") head(corn) # Parse the response into a raw character string. corn_text<- nassqs_parse(response, as = "text") head(corn_text) # Get a list of parameter values and parse as a list response <- nassqs_GET(list(param = "statisticcat_desc"), api_path = "get_param_values") statisticcat_desc_values <- nassqs_parse(response, as = "list") head(statisticcat_desc_values) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.