Learn R Programming

surveyPrev (version 1.0.0)

get_api_table: Function to obtain subnational estimates from DHS API

Description

Function to obtain subnational estimates from DHS API

Usage

get_api_table(country, survey, indicator, simplify = TRUE)

Value

a data frame of the DHS indicator estimates

Arguments

country

A character string of keys at: https://api.dhsprogram.com/rest/dhs/countries?returnFields=CountryName,DHS_CountryCode&f=html

survey

A character string of keys at: https://api.dhsprogram.com/rest/dhs/surveys?returnFields=SurveyId,SurveyYearLabel,SurveyType,CountryName&f=html

indicator

A character string of keys at: https://api.dhsprogram.com/rest/dhs/indicators?returnFields=IndicatorId,Label,Definition&f=html

simplify

if TRUE only the value and region index is returned.

Examples

Run this code
if (FALSE) {
# country:  Zambia
# survey: 2018 DHS
# indicator: Percentage of children stunted 
#             (below -2 SD of height for age 
#              according to the WHO standard)
dhs_table <- get_api_table(country = "ZM", 
                           survey = "ZM2018DHS", 
                           indicator = "CN_NUTS_C_HA2", 
                           simplify = TRUE)
dhs_table
}

Run the code above in your browser using DataLab