Description Usage Arguments Details Value See Also Examples
fetch_data
retrieves DHS API data and returns a dataframe with arguments to specify countries, years, indicators, tag, and level of disaggregation.
1 2 |
countries |
Specify countries by DHS country code. Use |
years |
Specify survey year(s) |
indicators |
Specify indicators by indicator_id. Use |
tag |
Specify tag. Use |
breakdown_level |
Specify level of data disaggregation. Options include "national" (default), "subnational", "background", and "all". |
add_geometry |
Set to "true" for inclusion of polygon coordinates. |
Set DHS API key with set_api_key
and return fields with set_return_fields
.
A list containing the API call and dataframe of the results.
fetch_countries
, fetch_indicators
, fetch_tags
1 2 3 4 5 6 7 8 9 | # Return all immunization tagged data for Ghana and Kenya from 2010 to 2016
fetch_data(countries = c("GH", "KE"), years = 2010:2016, tag = 32, breakdown_level = "all")
# Return all national-level data for "Assistance during delivery from a skilled provider" and
"Treatment of diarrhea: Taken to a health facility"
fetch_data(indicators = c("RH_DELA_C_SKP", "CH_DIAT_C_ADV"), breakdown_level = "national")
# Return all 2016 data with geometry for the tag "SDGs"
fetch_data(years = 2016, tag = 80, add_geometry = "true")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.