get_api_table: Function to obtain subnational estimates from DHS API

View source: R/get_api_table.R

get_api_tableR Documentation

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, admin = 1)

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.

admin

Either 0 (national) or 1 (subnational admin 1 area).

Value

a data frame of the DHS indicator estimates

Examples

## Not run: 
# 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

## End(Not run)


surveyPrev documentation built on June 19, 2026, 5:06 p.m.