fetch_data: Retrieve DHS API data

Description Usage Arguments Details Value See Also Examples

View source: R/fetch_data.R

Description

fetch_data retrieves DHS API data and returns a dataframe with arguments to specify countries, years, indicators, tag, and level of disaggregation.

Usage

1
2
fetch_data(countries = NULL, years = NULL, indicators = NULL,
  tag = NULL, breakdown_level = NULL, add_geometry = NULL)

Arguments

countries

Specify countries by DHS country code. Use fetch_countries for listing of DHS country codes.

years

Specify survey year(s)

indicators

Specify indicators by indicator_id. Use fetch_indicators for indicator details including indicator_ids.

tag

Specify tag. Use fetch_tags for details. NOTE: only 1 tag can be specified per call.

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.

Details

Set DHS API key with set_api_key and return fields with set_return_fields.

Value

A list containing the API call and dataframe of the results.

See Also

fetch_countries, fetch_indicators, fetch_tags

Examples

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")

murphy-xq/fetchdhs documentation built on May 14, 2019, 8:02 a.m.