getData | R Documentation |
calls the CDC Wonder API and returns a tidy data frame (tibble)
getData(
db = "D66",
querylist = NULL,
add = TRUE,
save = FALSE,
fn = "query.xml",
agree = TRUE
)
db |
Indicate the database, either by label, name, or code. To see the complete list of what's available, use 'show_databases()' |
querylist |
The query list supplied must be a list of lists of names and values. By default it is combined with the default query list for that database. To supply a full list and bypass the default query list, set |
add |
If |
save |
If |
fn |
filename for saved query list, defaults to |
agree |
Must be set to TRUE to agree to the CDC terms (default is TRUE). To see the terms for the particular dataset click on that dataset here: https://wonder.cdc.gov. sample |
Queries for mortality and births statistics from the National Vital Statistics System cannot limit or group results by any location field, such as Region, Division, State or County, or Urbanization (urbanization categories map to specific geographic counties).
For example, in the D76 online database for Detailed Mortality 1999-2013, the location fields are D76.V9, D76.V10 and D76.V27, and the urbanization fields are D76.V11 and D76.V19. These 'sub-national" data fields cannot be grouped by or limited via the API, although these fields are available in the web application.
See https://wonder.cdc.gov/wonder/help/WONDER-API.html for more information.
Inspired by this script from the wondr
package, but provides more user-friendly options and better table display: /urlhttps://github.com/hrbrmstr/wondr/blob/master/README.md
mylist <- list(
list("And By", "Race"),
list("And By", "Tobacco Use")
)
mydata <- getData("D66", mylist)
mydata
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.