Description Usage Arguments Details Value Author(s) Examples
Accesses information from the Demographic and Health Surveys, via their API.
1 2 3 4 |
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: |
last survey year to include. By default, will return everything from |
years: |
if specified, list of survey years to include as a string separated by commas, e.g. '2010,2012,2014'. Overrides |
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 |
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
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
Laura Hughes
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.