loadDHS: Access Demographic & Health Surveys Data

Description Usage Arguments Details Value Author(s) Examples

Description

Accesses information from the Demographic and Health Surveys, via their API.

Usage

1
2
3
4
loadDHS(breakdown = "national", indicators, countries, start_year = 1984,
  end_year = as.numeric(format(Sys.Date(), "%Y")), years = NA,
  apiKey = NA, numResults = 1000, return_gunk = FALSE,
  return_params = FALSE)

Arguments

breakdown

one of 'national', 'subnational', 'background', or 'all'. See http://api.dhsprogram.com/#/api-data.cfm for description

indicators:

either a list of indicator names/codes to search for, or a string of DHS indicator names/codes separated by commas, e.g. c('wasted', 'stunted', 'underweight') or CN_NUTS_C_WH2,CN_NUTS_C_HA2,CN_NUTS_C_WA2'

countries:

either a list of DHS country names or codes, or a string of country names/codes separated by commas, e.g. 'SN,SL,TG'

start_year:

first survey year to include. By default, will return everything from first year (1984) of survey to end_year.

end_year:

last survey year to include. By default, will return everything from start_year to present.

years:

if specified, list of survey years to include as a string separated by commas, e.g. '2010,2012,2014'. Overrides start_year and end_year; allows you to exclude years from analysis

apiKey:

API Key to include, to be able to obtain 5000 records instead of 1000 at a time.

numResults:

number of records to include

return_gunk:

TRUE/FALSE whether to return everything, or just the useful fields

return_params:

TRUE/FALSE whether to return the search parameters with the data

Details

Information is the same as from the DHS StatCompiler Documentation code for DHS API: http://api.dhsprogram.com/#/index.html

Filter options: http://api.dhsprogram.com/#/api-data.cfm

Country codes: http://dhsprogram.com/data/File-Types-and-Names.cfm#CP_JUMP_10136

Indicator codes: http://api.dhsprogram.com/rest/dhs/indicators?returnFields=IndicatorId,Label,Definition&f=html

Return value definitions: http://api.dhsprogram.com/rest/dhs/data/fields

Value

See http://api.dhsprogram.com/rest/dhs/data/fields for descriptions of the outputs. The default option (return_gunk = FALSE) returns only CountryName, DHS_CountryCode, SurveyYear, SurveyYearLabel, IndicatorId, Indicator, Definition, MeasurementType, Denominator, DenominatorWeighted, DenominatorUnweighted, Value, Percent, CILow, CIHigh, CharacteristicCategory, CharacteristicLabel, IsTotal

Author(s)

Laura Hughes

Examples

1
2
3
4
rw_stunting = loadDHS(breakdown = 'all', indicators = 'CN_NUTS_C_HA2,CN_NUTS_C_HA3', countries = 'RW', years = '2000,2015')
glimpse(rw_stunting)
rw_stunting = loadDHS(breakdown = 'subnational', indicators = 'stunted', countries = 'Rwanda', start_year = 2005, end_year = 2015)
malnutrition = loadDHS(breakdown = 'national', indicators = c('stunted', 'wasted', 'underweight'), countries = c('Rwanda', 'Burundi', 'Niger'), return_params = TRUE)

flaneuse/svywrangler documentation built on May 24, 2019, 2:49 p.m.