Created on May 02, 2021 || Updated on May 09, 2021  



1.0 Background

The objective of this analysis is to explore the distribution and variations in the patterns of key child health indicators among selected developing countries. The indicators being explored are:

This exploratory analysis is based on tabulated indicators by the Demographic and Health Survey (DHS) program freely accessible at the program’s website. Country classification into sub-regions was based on the standard country or area codes for statistical use (M49) compiled by the United Nations Department of Economic and Social Affairs’ Statistics Division.



2.0 Data processing

p_load(tidyverse,dplyr,tidyr,readr,readxl,openxlsx)

In the steps that follow, I read in and merged tabular indicator dataframes into single structured dataframe. I also made necessary adjustments to variable names and recoded variable labels where necessary:

2.1 Read in datasets

files <- list.files(getwd(), pattern = ".xlsx", full.names = T)
files
[1] "C:/rsch/lead/stat/02/a/~$countrylist.xlsx"   
[2] "C:/rsch/lead/stat/02/a/~$dhs_indicators.xlsx"
[3] "C:/rsch/lead/stat/02/a/dhs_indicators.xlsx"  
[4] "C:/rsch/lead/stat/02/a/unsd_regions.xlsx"    
getSheetNames(files[3])
 [1] "UnderfiveStunting"               "InfantMortality"                
 [3] "UnderfiveMortality"              "ExclusiveBreastfeeding"         
 [5] "IYCF"                            "MinimumFoodGroups&MealFrequency"
 [7] "ModernContraception"             "UnmetNeeds"                     
 [9] "MaternalThinness"                "MaternalObesity"                
[11] "SecondaryEducation"              "WomenEmployment"                
[13] "FinalSayInAllDecisions"          "FGC"                            
dt_chstun <- read_xlsx("C:/rsch/lead/stat/02/a/dhs_indicators.xlsx", sheet=1)
dt_u1mort <- read_xlsx("C:/rsch/lead/stat/02/a/dhs_indicators.xlsx", sheet=2)
dt_u5mort <- read_xlsx("C:/rsch/lead/stat/02/a/dhs_indicators.xlsx", sheet=3)
dt_region <- read_xlsx(files[4])[,1:5]
names(dt_chstun)
[1] "Country"            "Most Recent Survey" "Total"             
names(dt_region)
[1] "Sub-region Name"          "Intermediate Region Name"
[3] "Country"                  "ISO-alpha2 Code"         
[5] "ISO-alpha3 Code"         

2.2 Adjust and rename vectors

# clean column names
colClean_fn <- function(x){
  colnames(x) <- gsub(pattern=" |-|/", replacement="", x=colnames(x)); x} 

dt_chstun <- colClean_fn(dt_chstun) 
dt_chstun <- dt_chstun %>% transmute(Country=Country, RecentDHS=MostRecentSurvey, CSP=Total)

dt_u1mort <- colClean_fn(dt_u1mort) 
dt_u1mort <- dt_u1mort %>% transmute(Country=Country, RecentDHS=MostRecentSurvey, IMR=Total)

dt_u5mort <- colClean_fn(dt_u5mort) 
dt_u5mort <- dt_u5mort %>% transmute(Country=Country, RecentDHS=MostRecentSurvey, UMR=Total)

dt_region <- colClean_fn(dt_region) 
dt_region <- dt_region %>% transmute(Subregion=SubregionName, Subregion2=IntermediateRegionName, 
                                     Country=Country, ISO_A2=ISOalpha2Code, ISO_A3=ISOalpha3Code)
names(dt_chstun)
[1] "Country"   "RecentDHS" "CSP"      
names(dt_region) 
[1] "Subregion"  "Subregion2" "Country"    "ISO_A2"     "ISO_A3"    

2.3 Merge datasets

dt_merged <- merge(dt_chstun, dt_u1mort, by = c(1:2), all.x = TRUE)
dt_merged <- merge(dt_merged, dt_u5mort, by = c(1:2), all.x = TRUE)
dt_merged <- merge(dt_region, dt_merged, by = "Country", all.y = TRUE)

names(dt_merged)
[1] "Country"    "Subregion"  "Subregion2" "ISO_A2"     "ISO_A3"    
[6] "RecentDHS"  "CSP"        "IMR"        "UMR"       
knitr::kable(head(dt_merged, 20), 
             caption = "Tab 1a. Combined indicators and geographic raw datasets")
Tab 1a. Combined indicators and geographic raw datasets
Country Subregion Subregion2 ISO_A2 ISO_A3 RecentDHS CSP IMR UMR
Albania Southern Europe Southern Europe AL ALB DHS 2017-18 0.113 NA NA
Angola Sub-Saharan Africa Middle Africa AO AGO DHS 2015-16 0.376 44(CI: 39 - 50) 68(CI: 61 - 76)
Armenia Western Asia Western Asia AM ARM DHS 2015-16 0.094 4(CI: 1 - 7) 6(CI: 3 - 10)
Azerbaijan Western Asia Western Asia AZ AZE DHS 2006 0.251 43(CI: 32 - 54) 50(CI: 38 - 61)
Bangladesh Southern Asia Southern Asia BD BGD DHS 2017-18 0.308 38(CI: 33 - 43) 45(CI: 40 - 50)
Benin Sub-Saharan Africa Western Africa BJ BEN DHS 2017-18 0.322 55(CI: 50 - 60) 96(CI: 90 - 103)
Bolivia NA NA NA NA DHS 2008 0.271 50(CI: 43 - 56) 63(CI: 56 - 70)
Burkina Faso Sub-Saharan Africa Western Africa BF BFA DHS 2010 0.346 65(CI: 60 - 70) 129(CI: 120 - 137)
Burundi Sub-Saharan Africa Eastern Africa BI BDI DHS 2016-17 0.559 47(CI: 42 - 52) 78(CI: 71 - 85)
Cambodia South-eastern Asia South-eastern Asia KH KHM DHS 2014 0.324 28(CI: 22 - 34) 35(CI: 28 - 41)
Cameroon Sub-Saharan Africa Middle Africa CM CMR DHS 2018 0.289 48(CI: 42 - 53) 80(CI: 72 - 87)
Chad Sub-Saharan Africa Middle Africa TD TCD DHS 2014-15 0.399 72(CI: 66 - 78) 133(CI: 125 - 141)
Colombia Latin America and the Caribbean South America CO COL DHS 2010 0.132 NA NA
Comoros Sub-Saharan Africa Eastern Africa KM COM DHS 2012 0.301 36(CI: 27 - 45) 50(CI: 38 - 61)
Congo Sub-Saharan Africa Middle Africa CG COG DHS 2011-12 0.244 39(CI: 33 - 46) 68(CI: 59 - 76)
Congo Democratic Republic NA NA NA NA DHS 2013-14 0.427 58(CI: 53 - 63) 104(CI: 97 - 112)
Cote d’Ivoire NA NA NA NA DHS 2011-12 0.298 68(CI: 59 - 77) 108(CI: 97 - 119)
Dominican Republic Latin America and the Caribbean Caribbean DO DOM DHS 2013 0.069 27(CI: 20 - 35) 31(CI: 23 - 39)
Egypt Northern Africa Northern Africa EG EGY DHS 2014 0.214 22(CI: 19 - 25) 27(CI: 24 - 31)
Eritrea Sub-Saharan Africa Eastern Africa ER ERI DHS 2002 0.429 48(CI: 41 - 54) 93(CI: 84 - 103)

2.4 Imput missing subregions

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Bolivia", "Latin America and the Caribbean", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Bolivia", "South America", dt_merged$Subregion2)

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Congo Democratic Republic", "Sub-Saharan Africa", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Congo Democratic Republic", "Middle Africa", dt_merged$Subregion2)

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Cote d'Ivoire", "Sub-Saharan Africa", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Cote d'Ivoire", "Western Africa", dt_merged$Subregion2)

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Kyrgyz Republic", "Central Asia", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Kyrgyz Republic", "Central Asia", dt_merged$Subregion2)

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Moldova", "South-eastern Asia", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Moldova", "South-eastern Asia", dt_merged$Subregion2)

dt_merged$Subregion<-
  ifelse(dt_merged$Country=="Tanzania", "Sub-Saharan Africa", dt_merged$Subregion)
dt_merged$Subregion2<-
  ifelse(dt_merged$Country=="Tanzania", "Eastern Africa", dt_merged$Subregion2)

dt_merged<-na.omit(dt_merged)
knitr::kable(head(dt_merged, 20), 
             caption = "Tab 1b. Updated combined indicators and geographic raw datasets")
Tab 1b. Updated combined indicators and geographic raw datasets
Country Subregion Subregion2 ISO_A2 ISO_A3 RecentDHS CSP IMR UMR
2 Angola Sub-Saharan Africa Middle Africa AO AGO DHS 2015-16 0.376 44(CI: 39 - 50) 68(CI: 61 - 76)
3 Armenia Western Asia Western Asia AM ARM DHS 2015-16 0.094 4(CI: 1 - 7) 6(CI: 3 - 10)
4 Azerbaijan Western Asia Western Asia AZ AZE DHS 2006 0.251 43(CI: 32 - 54) 50(CI: 38 - 61)
5 Bangladesh Southern Asia Southern Asia BD BGD DHS 2017-18 0.308 38(CI: 33 - 43) 45(CI: 40 - 50)
6 Benin Sub-Saharan Africa Western Africa BJ BEN DHS 2017-18 0.322 55(CI: 50 - 60) 96(CI: 90 - 103)
8 Burkina Faso Sub-Saharan Africa Western Africa BF BFA DHS 2010 0.346 65(CI: 60 - 70) 129(CI: 120 - 137)
9 Burundi Sub-Saharan Africa Eastern Africa BI BDI DHS 2016-17 0.559 47(CI: 42 - 52) 78(CI: 71 - 85)
10 Cambodia South-eastern Asia South-eastern Asia KH KHM DHS 2014 0.324 28(CI: 22 - 34) 35(CI: 28 - 41)
11 Cameroon Sub-Saharan Africa Middle Africa CM CMR DHS 2018 0.289 48(CI: 42 - 53) 80(CI: 72 - 87)
12 Chad Sub-Saharan Africa Middle Africa TD TCD DHS 2014-15 0.399 72(CI: 66 - 78) 133(CI: 125 - 141)
14 Comoros Sub-Saharan Africa Eastern Africa KM COM DHS 2012 0.301 36(CI: 27 - 45) 50(CI: 38 - 61)
15 Congo Sub-Saharan Africa Middle Africa CG COG DHS 2011-12 0.244 39(CI: 33 - 46) 68(CI: 59 - 76)
18 Dominican Republic Latin America and the Caribbean Caribbean DO DOM DHS 2013 0.069 27(CI: 20 - 35) 31(CI: 23 - 39)
19 Egypt Northern Africa Northern Africa EG EGY DHS 2014 0.214 22(CI: 19 - 25) 27(CI: 24 - 31)
20 Eritrea Sub-Saharan Africa Eastern Africa ER ERI DHS 2002 0.429 48(CI: 41 - 54) 93(CI: 84 - 103)
21 Eswatini Sub-Saharan Africa Southern Africa SZ SWZ DHS 2006-07 0.289 85(CI: 73 - 97) 120(CI: 105 - 135)
22 Ethiopia Sub-Saharan Africa Eastern Africa ET ETH DHS 2019 0.368 47(CI: 36 - 57) 59(CI: 48 - 70)
23 Gabon Sub-Saharan Africa Middle Africa GA GAB DHS 2012 0.165 43(CI: 35 - 50) 65(CI: 56 - 74)
24 Gambia Sub-Saharan Africa Western Africa GM GMB DHS 2013 0.245 34(CI: 28 - 40) 54(CI: 45 - 62)
25 Ghana Sub-Saharan Africa Western Africa GH GHA DHS 2014 0.188 41(CI: 34 - 48) 60(CI: 52 - 68)

2.5 Extract CSP, IMR and UMR estimates

Here, I extract only the point estimates of the indicators eliminating the corresponding confidence intervals (CI) seen in the above table. Also, I changed the CSP from proportion to percentage format. This is done to improve the usability of the estimates and the intuitiveness of the analysis.

# Extract values/characters before pattern
dt_merged <- 
  dt_merged %>%
  mutate(CSP=CSP*100) %>%
  filter(!Subregion%in%c("Central Asia","Western Asia"))

dt_merged$IMR<-as.character(dt_merged$IMR)
dt_merged$IMR<-substr(dt_merged$IMR, 1, 3)
dt_merged$IMR<-as.numeric(gsub(".*?([0-9]+).*", "\\1", dt_merged$IMR)) 

dt_merged$UMR<-as.character(dt_merged$UMR)
dt_merged$UMR<-substr(dt_merged$UMR, 1, 3)
dt_merged$UMR<-as.numeric(gsub(".*?([0-9]+).*", "\\1", dt_merged$UMR)) 

#View(dt_merged)
knitr::kable(psych::headTail(dt_merged[,-2],10,10), 
             caption = "Tab 2. Indicators point estimates only (excluding confidence intervals)")
Tab 2. Indicators point estimates only (excluding confidence intervals)
Country Subregion2 ISO_A2 ISO_A3 RecentDHS CSP IMR UMR
1 Angola Middle Africa AO AGO DHS 2015-16 37.6 44 68
2 Bangladesh Southern Asia BD BGD DHS 2017-18 30.8 38 45
3 Benin Western Africa BJ BEN DHS 2017-18 32.2 55 96
4 Burkina Faso Western Africa BF BFA DHS 2010 34.6 65 129
5 Burundi Eastern Africa BI BDI DHS 2016-17 55.9 47 78
6 Cambodia South-eastern Asia KH KHM DHS 2014 32.4 28 35
7 Cameroon Middle Africa CM CMR DHS 2018 28.9 48 80
8 Chad Middle Africa TD TCD DHS 2014-15 39.9 72 133
9 Comoros Eastern Africa KM COM DHS 2012 30.1 36 50
10 Congo Middle Africa CG COG DHS 2011-12 24.4 39 68
NA NA NA NA NA
42 Rwanda Eastern Africa RW RWA DHS 2014-15 37.9 32 50
43 Sao Tome and Principe Middle Africa ST STP DHS 2008-09 29.3 38 63
44 Senegal Western Africa SN SEN DHS 2019 17.9 29 37
45 Sierra Leone Western Africa SL SLE DHS 2019 29.5 75 122
46 South Africa Southern Africa ZA ZAF DHS 2016 27.4 35 42
47 Timor-Leste South-eastern Asia TL TLS DHS 2016 45.6 30 41
48 Togo Western Africa TG TGO DHS 2013-14 27.5 49 88
49 Uganda Eastern Africa UG UGA DHS 2016 28.9 43 64
50 Zambia Eastern Africa ZM ZMB DHS 2018 34.6 42 61
51 Zimbabwe Eastern Africa ZW ZWE DHS 2015 26.8 50 69

2.6 Derive grouping quantities for CSP, IMR and UMR

First, I summarize the CSP, IMR, and UMR indicators to determine the appropriate grouping cut-off values for each:

knitr::kable(descr(dt_merged), 
             caption = "Tab 3. Summary statistics of indicators point estimates")
Tab 3. Summary statistics of indicators point estimates
CSP IMR UMR
Mean 30.59216 44.41176 67.47059
Std.Dev 9.58730 15.03619 30.77814
Min 6.90000 17.00000 20.00000
Q1 24.40000 34.00000 42.00000
Median 29.50000 42.00000 63.00000
Q3 37.10000 54.00000 88.00000
Max 55.90000 85.00000 133.00000
MAD 10.22994 13.34340 32.61720
IQR 12.50000 18.00000 43.00000
CV 0.31339 0.33856 0.45617
Skewness 0.21005 0.50034 0.60151
SE.Skewness 0.33346 0.33346 0.33346
Kurtosis 0.01934 -0.20984 -0.60087
N.Valid 51.00000 51.00000 51.00000
Pct.Valid 100.00000 100.00000 100.00000

Then, I proceed to group countries into Low and High level CSP, IMR, and UMR countries using median cut-off point. Countries with level below the median value are classified as low-level countries, while those with values equals or higher than the median are regarded as high-level countries.

2.6.1 Childhood stunting

dt_merged$CSP_grouped<-cut_interval(dt_merged$CSP, 5)
freq(dt_merged$CSP_grouped)

|          &nbsp; | Freq |     % |
|----------------:|-----:|------:|
|  **[6.9,16.7]** |    3 |   5.9 |
| **(16.7,26.5]** |   13 |  25.5 |
| **(26.5,36.3]** |   20 |  39.2 |
| **(36.3,46.1]** |   12 |  23.5 |
| **(46.1,55.9]** |    3 |   5.9 |
|       **Total** |   51 | 100.0 |
dt_merged$CSP_grouped<-
  factor(dt_merged$CSP_grouped,
         levels=c("[6.9,16.7]","(16.7,26.5]","(26.5,36.3]","(36.3,46.1]","(46.1,55.9]"),
         labels=c("Lowest","Lower","Middle","Higher","Highest"))
freq(dt_merged$CSP_grouped)

|      &nbsp; | Freq |     % |
|------------:|-----:|------:|
|  **Lowest** |    3 |   5.9 |
|   **Lower** |   13 |  25.5 |
|  **Middle** |   20 |  39.2 |
|  **Higher** |   12 |  23.5 |
| **Highest** |    3 |   5.9 |
|   **Total** |   51 | 100.0 |

2.6.2 Infant mortality

dt_merged$IMR_grouped<-cut_interval(dt_merged$IMR, 5)
freq(dt_merged$IMR_grouped)

|          &nbsp; | Freq |     % |
|----------------:|-----:|------:|
|   **[17,30.6]** |    9 |  17.6 |
| **(30.6,44.2]** |   21 |  41.2 |
| **(44.2,57.8]** |   10 |  19.6 |
| **(57.8,71.4]** |    8 |  15.7 |
|   **(71.4,85]** |    3 |   5.9 |
|       **Total** |   51 | 100.0 |
dt_merged$IMR_grouped<-
  factor(dt_merged$IMR_grouped,
         levels=c("[17,30.6]","(30.6,44.2]","(44.2,57.8]","(57.8,71.4]","(71.4,85]"),
         labels=c("Lowest","Lower","Middle","Higher","Highest"))
freq(dt_merged$IMR_grouped)

|      &nbsp; | Freq |     % |
|------------:|-----:|------:|
|  **Lowest** |    9 |  17.6 |
|   **Lower** |   21 |  41.2 |
|  **Middle** |   10 |  19.6 |
|  **Higher** |    8 |  15.7 |
| **Highest** |    3 |   5.9 |
|   **Total** |   51 | 100.0 |

2.6.3 Underfive mortality

dt_merged$UMR_grouped<-cut_interval(dt_merged$UMR, 5)
freq(dt_merged$UMR_grouped)

|          &nbsp; | Freq |     % |
|----------------:|-----:|------:|
|   **[20,42.6]** |   13 |  25.5 |
| **(42.6,65.2]** |   16 |  31.4 |
| **(65.2,87.8]** |    9 |  17.6 |
|  **(87.8,110]** |    6 |  11.8 |
|   **(110,133]** |    7 |  13.7 |
|       **Total** |   51 | 100.0 |
dt_merged$UMR_grouped<-
  factor(dt_merged$UMR_grouped,
         levels=c("[20,42.6]","(42.6,65.2]","(65.2,87.8]","(87.8,110]","(110,133]"),
         labels=c("Lowest","Lower","Middle","Higher","Highest"))
freq(dt_merged$UMR_grouped)

|      &nbsp; | Freq |     % |
|------------:|-----:|------:|
|  **Lowest** |   13 |  25.5 |
|   **Lower** |   16 |  31.4 |
|  **Middle** |    9 |  17.6 |
|  **Higher** |    6 |  11.8 |
| **Highest** |    7 |  13.7 |
|   **Total** |   51 | 100.0 |
knitr::kable(psych::headTail(dt_merged[,-(2:6)],10,9),
             caption = "Tab 4. Countries classification by level of indicators")
Tab 4. Countries classification by level of indicators
Country CSP IMR UMR CSP_grouped IMR_grouped UMR_grouped
1 Angola 37.6 44 68 Higher Lower Middle
2 Bangladesh 30.8 38 45 Middle Lower Lower
3 Benin 32.2 55 96 Middle Middle Higher
4 Burkina Faso 34.6 65 129 Middle Higher Highest
5 Burundi 55.9 47 78 Highest Middle Middle
6 Cambodia 32.4 28 35 Middle Lowest Lowest
7 Cameroon 28.9 48 80 Middle Middle Middle
8 Chad 39.9 72 133 Higher Highest Highest
9 Comoros 30.1 36 50 Middle Lower Lower
10 Congo 24.4 39 68 Lower Lower Middle
NA NA NA NA
43 Sao Tome and Principe 29.3 38 63 Middle Lower Lower
44 Senegal 17.9 29 37 Lower Lowest Lowest
45 Sierra Leone 29.5 75 122 Middle Highest Highest
46 South Africa 27.4 35 42 Middle Lower Lowest
47 Timor-Leste 45.6 30 41 Higher Lowest Lowest
48 Togo 27.5 49 88 Middle Middle Higher
49 Uganda 28.9 43 64 Middle Lower Lower
50 Zambia 34.6 42 61 Middle Lower Lower
51 Zimbabwe 26.8 50 69 Middle Middle Middle

3.0 Results

3.1 Correlation matrix

dt_merged %>%
select(CSP:UMR) %>% 
ggcorrm(rescale = "by_sd") +
  utri_heatmap(alpha = 0.5) +
  lotri_heatcircle(alpha = 0.5, col = 1) +
  utri_corrtext() +
  dia_names(y_pos = 0.15, size = 3) +
  dia_density(lower = 0.3, fill = "lightgrey", color = 1) +
  scale_fill_corr()

The above correlation matrix chart shows very strong positive relationship between infant and underfive mortality rates, as expected, but very weak association between the two mortality indicators and childhood stunting prevalence. This suggest that some countries ranked high on IMR and UMR indicators but ranked low on CSP measure.

3.2 Bar charts and Maps

Figures 2-7 highlight substantial variations in CSP, IMR and UMR among countries. However, the results show that children from sub-Saharan African countries are worse off in all the three indicators considered compared with their peers from others regions.

fig<-     
  ggplot(data=dt_merged, aes(x=reorder(Country,-desc(CSP)), y= CSP, fill=Subregion)) +
  geom_bar(stat = "identity", colour="black", size=.1) +
  coord_flip() + labs(x=" ", y="CSP", fill=" ") +
  theme_minimal() + scale_fill_brewer(palette = "Reds", direction = 1) 

fig <- 
  ggplotly(fig, height=800, width=1000) %>%
  layout(xaxis = list(title = "", showgrid = F,  
                      zeroline = T, showticklabels = F, hoverformat = '.2f'), 
         yaxis = list(title = "", showgrid = F, zeroline = F, showticklabels = T),
         legend = list(orientation = 'v', y = 0.9), font=font) %>%
  add_annotations(yref="paper", xref="paper", 
                  y=-.05, x=-.23, showarrow=F, font=list(size=13),
                  text="Fig 2. Childhood stunting prevalence by country; countries with available DHS estimates") 
fig
fig<-     
  ggplot(data=dt_merged, aes(x=reorder(Country,-desc(IMR)), y= IMR, fill=Subregion)) +
  geom_bar(stat = "identity", colour="black", size=.1) +
  coord_flip() + labs(x=" ", y="IMR", fill=" ") +
  theme_minimal() + scale_fill_brewer(palette = "Reds", direction = 1) 

fig <- 
  ggplotly(fig, height=800, width=1000) %>%
  layout(xaxis = list(title = "", showgrid = F,  
                      zeroline = T, showticklabels = F, hoverformat = '.2f'), 
         yaxis = list(title = "", showgrid = F, zeroline = F, showticklabels = T),
         legend = list(orientation = 'v', y = 0.9), font=font) %>%
  add_annotations(yref="paper", xref="paper", 
                  y=-.05, x=-.23, showarrow=F, font=list(size=13),
                  text="Fig 3. Infant mortality rates by country; countries with available DHS estimates") 
fig
fig<-     
  ggplot(data=dt_merged, aes(x=reorder(Country,-desc(UMR)), y= UMR, fill=Subregion)) +
  geom_bar(stat = "identity", colour="black", size=.1) +
  coord_flip() + labs(x=" ", y="UMR", fill=" ") +
  theme_minimal() + scale_fill_brewer(palette = "Reds", direction = 1) 

fig <- 
  ggplotly(fig, height=800, width=1000) %>%
  layout(xaxis = list(title = "", showgrid = F,  
                      zeroline = T, showticklabels = F, hoverformat = '.2f'), 
         yaxis = list(title = "", showgrid = F, zeroline = F, showticklabels = T),
         legend = list(orientation = 'v', y = 0.9), font=font) %>%
  add_annotations(yref="paper", xref="paper", 
                  y=-.05, x=-.23, showarrow=F, font=list(size=13),
                  text="Fig 4. Underfive mortality rates by country; countries with available DHS estimates") 
fig
library(rnaturalearth)
world <- ne_countries(returnclass = "sf")
world <- world %>%
  filter(subregion!="Antarctica", subregion!="Seven seas (open ocean)") %>%
  select(continent, subregion, region_wb, name, iso_a2, iso_a3, type, income_grp, economy)
dt_spatialviz <- geo_join(world, dt_merged, 'iso_a2', 'ISO_A2', how = 'inner')

#names(dt_spatialviz)

The primary data file dt_merged comprises of 51, whereas the combined dt_spatialviz spatial dataframe has 48 matched countries.

fig <- 
  plot_ly(dt_spatialviz, split = ~name, color = ~CSP_grouped, 
          stroke = I("black"), span = I(.5), height=400, width=800,
  text = ~paste("Country:", name, "\nSubregion:", Subregion2, "\nCSP level:", CSP_grouped),
  hoveron = "fills", hoverinfo = "text", showlegend = F, alpha = 1.5) %>%
  layout(legend = list(orientation = 'v', 
                       xanchor = "center", x = 0.8, y = 0.1, title=list(text='<b> CSP level </b>')),
         font=font) %>%
  add_annotations(yref="paper", xref="paper", y=-.05, x=-.05, showarrow=F, font=list(size=13),
                  text="Fig 5. Spatial pattern of childhood stunting; countries with available DHS estimates") 
fig
fig <- 
  plot_ly(dt_spatialviz, split = ~name, color = ~IMR_grouped,
          stroke = I("black"), span = I(.5), height=400, width=800,
  text = ~paste("Country:", name, "\nSubregion:", Subregion2, "\nIMR level:", IMR_grouped),
  hoveron = "fills", hoverinfo = "text", showlegend = F, alpha = 1.5) %>%
  layout(legend = list(orientation = 'v', 
                       xanchor = "center", x = 0.8, y = 0.1, title=list(text='<b> IMR level </b>')),
         font=font) %>%
  add_annotations(yref="paper", xref="paper", y=-.05, x=-.05, showarrow=F, font=list(size=13),
                  text="Fig 6. Spatial pattern of infant mortality; countries with available DHS estimates") 
fig
fig <- 
  plot_ly(dt_spatialviz, split = ~name, color = ~UMR_grouped, 
          stroke = I("black"), span = I(.5), height=400, width=800,
  text = ~paste("Country:", name, "\nSubregion:", Subregion2, "\nUMR level:", UMR_grouped),
  hoveron = "fills", hoverinfo = "text", showlegend = F, alpha = 1.5) %>%
  layout(legend = list(orientation = 'v', 
                       xanchor = "center", x = 0.8, y = 0.1, title=list(text='<b> UMR level </b>')),
         font=font) %>%
  add_annotations(yref="paper", xref="paper", y=-.05, x=-.05, showarrow=F, font=list(size=13),
                  text="Fig 7. Spatial pattern of Underfive mortality; countries with available DHS estimates") 
fig

  1. DoD, HCaP, UTSA, ↩︎