library(tidyverse)
library(kableExtra)
library(knitr)
library(stringr)
library(readr)
library(plyr)
library(dplyr)
library(data.table)
library(readxl)
require(xlsx)
library(rJava)
library(xlsx)

World Bank Info For Infant Mortality And Tuberculosis

#Manually Load in CSV
Uganda<- read.csv("uganda.csv",na.strings=c("","NA"))
Ukraine <- read.csv("Ukraine.csv",na.strings=c("","NA"))
United_kingdom <- read.csv("United_Kingdom.csv",na.strings=c("","NA"))
United_states <- read.csv("United_states.csv",na.strings=c("","NA"))


# Functional to load csv
files <- c("Uganda.csv", "Ukraine.csv", "United_Kingdom.csv", "United_states.csv")
temp = files
myfiles <-lapply(temp,read.csv)

Join On Shared Row Index Values(Survey Questions)

merged_df<- inner_join(United_states,United_kingdom) %>% 
    inner_join(.,Ukraine) %>% 
    inner_join(.,Uganda)

# With Functional data
merged_df_2<- inner_join(myfiles[[1]],myfiles[[2]]) %>% 
    inner_join(myfiles[[3]]) %>%   
    inner_join(myfiles[[4]])
kable(merged_df_2[1:15,])
X Uganda Uganda.1 Uganda.2 Uganda.3 Uganda.4 Uganda.5 Uganda.6 Uganda.7 Uganda.8 Uganda.9 Uganda.10 Uganda.11 Uganda.12 Uganda.13 Ukraine Ukraine.1 Ukraine.2 Ukraine.3 Ukraine.4 Ukraine.5 Ukraine.6 Ukraine.7 Ukraine.8 Ukraine.9 Ukraine.10 Ukraine.11 Ukraine.12 Ukraine.13 United.Kingdom.of.Great.Britain.and.Northern.Ireland United.Kingdom.of.Great.Britain.and.Northern.Ireland.1 United.Kingdom.of.Great.Britain.and.Northern.Ireland.2 United.Kingdom.of.Great.Britain.and.Northern.Ireland.3 United.Kingdom.of.Great.Britain.and.Northern.Ireland.4 United.Kingdom.of.Great.Britain.and.Northern.Ireland.5 United.Kingdom.of.Great.Britain.and.Northern.Ireland.6 United.Kingdom.of.Great.Britain.and.Northern.Ireland.7 United.Kingdom.of.Great.Britain.and.Northern.Ireland.8 United.Kingdom.of.Great.Britain.and.Northern.Ireland.9 United.Kingdom.of.Great.Britain.and.Northern.Ireland.10 United.Kingdom.of.Great.Britain.and.Northern.Ireland.11 United.Kingdom.of.Great.Britain.and.Northern.Ireland.12 United.Kingdom.of.Great.Britain.and.Northern.Ireland.13 United.States.of.America United.States.of.America.1 United.States.of.America.2 United.States.of.America.3 United.States.of.America.4 United.States.of.America.5 United.States.of.America.6 United.States.of.America.7 United.States.of.America.8 United.States.of.America.9 United.States.of.America.10 United.States.of.America.11 United.States.of.America.12 United.States.of.America.13
Indicator 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002
Antiretroviral therapy coverage among people with HIV infection eligible for ART according to 2010 guidelines (%) 64 [57-71] 41 [36-47] No data No data
Cellular subscribers (per 100 population) 45 48 38 130 123 119 135 131 131 95 93 90
Civil registration coverage of births (%) 29.9 99.8 99.8 100 100 100 100
Gross national income per capita (PPP int. $) 1320 1310 1240 1200 1150 1070 990 890 840 800 760 8670 8170 7590 7130 8370 7930 7110 6410 6000 5170 4590 34640 35270 34510 35260 37110 36480 35620 33820 32430 30450 29390 52620 50860 48880 47240 48650 48420 47390 44740 42260 39960 38590
Prevalence of HIV among adults aged 15 to 49 (%) 7.4 [6.9-7.8] 7.9 [7.3-8.4] 0.8 [0.8-0.8] 0.8 [0.7-0.8] No data No data 0.5 [0.5-0.5] No data
Total fertility rate (per woman) 5.9 5.96 6.06 1.5 1.46 1.45 1.9 1.9 1.9 2.0 1.99 2
Tuberculosis treatment coverage 52 [34-87] 56 [39-89] 60 [42-91] 60 [43-91] 64 [47-92] 60 [43-91] 60 [42-91] 61 [44-92] 60 [43-92] 61 [43-92] 62 [44-92] 66 [49-94] 65 [48-94] 62 [44-92] 74 [52-110] 75 [52-120] 84 [59-130] 90 [63-140] 71 [50-110] 67 [47-100] 68 [48-110] 69 [48-110] 66 [46-100] 71 [49-110] 67 [47-100] No data 130 [91-200] 68 [48-110] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 89 [81-98] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100] 87 [75-100]
Number of under-five deaths (thousands) 93 97 103 109 114 119 124 130 137 145 155 164 173 181 5 5 5 5 5 6 6 6 6 6 6 6 6 7 4 4 4 4 4 4 4 4 4 4 4 4 4 4 26 27 27 28 29 30 31 31 32 33 33 33 33 33
Infant mortality rate (probability of dying between birth and age 1 per 1000 live births) 39.2 [35.4-43.3] 41.0 [37.8-44.5] 43.9 [40.8-47.2] 46.5 [43.2-50.0] 49.5 [46.1-53.3] 52.7 [49.2-56.4] 55.7 [52.2-59.3] 58.9 [55.4-62.5] 63.3 [59.6-67.3] 68.6 [64.7-72.7] 74.4 [70.3-78.7] 80.5 [76.3-85.0] 86.7 [82.0-91.4] 92.5 [87.5-97.5] 8.1 [7.8-8.4] 8.4 [8.1-8.7] 8.8 [8.5-9.0] 9.2 [8.9-9.4] 9.6 [9.3-9.9] 10.1 [9.8-10.4] 10.6 [10.3-10.9] 11.1 [10.8-11.4] 11.6 [11.3-11.9] 12.0 [11.7-12.3] 12.5 [12.0-12.9] 13.0 [12.3-13.6] 13.7 [12.8-14.5] 14.3 [13.2-15.4] 3.7 [3.6-3.9] 3.8 [3.7-3.9] 3.9 [3.8-4.0] 4.1 [4.0-4.2] 4.2 [4.2-4.3] 4.4 [4.3-4.5] 4.6 [4.5-4.7] 4.8 [4.7-4.9] 4.9 [4.8-5.0] 5.0 [4.9-5.1] 5.1 [5.0-5.2] 5.3 [5.2-5.4] 5.4 [5.3-5.4] 5.4 [5.3-5.5] 5.7 [5.4-5.9] 5.8 [5.7-6.0] 5.9 [5.8-6.0] 6.0 [5.9-6.1] 6.1 [6.0-6.3] 6.2 [6.1-6.3] 6.4 [6.3-6.5] 6.5 [6.4-6.6] 6.6 [6.5-6.7] 6.7 [6.6-6.8] 6.8 [6.7-6.9] 6.9 [6.8-7.0] 6.9 [6.7-7.0] 6.9 [6.8-7.0]
Number of infant deaths (thousands) 66 68 71 73 76 79 82 84 88 93 99 104 109 112 4 4 4 5 5 5 5 5 5 5 5 5 6 6 3 3 3 3 3 3 4 4 4 4 4 4 4 4 23 23 23 24 25 25 26 27 27 28 28 28 28 28
Number of neonatal deaths (thousands) 38 38 38 38 38 38 38 38 38 38 38 39 39 40 3 3 3 3 3 3 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 3 3 3 2 2 2 15 16 16 16 16 17 17 17 18 18 19 19 19 19
Neonatal mortality rate (per 1000 live births) 22.0 [18.4-26.2] 22.6 [19.4-26.4] 23.3 [20.1-26.8] 23.9 [20.7-27.4] 24.4 [21.3-27.9] 24.9 [21.8-28.3] 25.4 [22.4-28.6] 26.0 [23.0-29.2] 26.6 [23.6-30.0] 27.4 [24.2-30.8] 28.3 [24.8-31.9] 29.4 [25.8-33.0] 30.5 [26.9-34.4] 31.9 [28.1-35.9] 5.6 [3.7-7.2] 5.9 [3.9-7.5] 6.1 [4.2-7.7] 6.4 [4.4-8.0] 6.7 [4.8-8.3] 7.0 [5.1-8.6] 7.4 [5.5-8.9] 7.7 [5.8-9.3] 8.0 [6.2-9.5] 8.4 [6.6-9.8] 8.7 [7.0-10.0] 9.1 [7.5-10.4] 9.5 [7.9-11.0] 10.0 [8.4-11.6] 2.7 [2.2-3.1] 2.8 [2.4-3.1] 2.8 [2.6-3.1] 2.9 [2.7-3.1] 3.0 [2.8-3.1] 3.1 [2.9-3.2] 3.1 [3.0-3.3] 3.2 [3.1-3.4] 3.3 [3.2-3.5] 3.4 [3.3-3.6] 3.5 [3.3-3.7] 3.5 [3.4-3.7] 3.5 [3.4-3.7] 3.6 [3.4-3.8] 3.8 [3.5-4.0] 3.9 [3.7-4.1] 4.0 [3.8-4.2] 4.0 [3.8-4.2] 4.0 [3.9-4.2] 4.1 [3.9-4.3] 4.2 [4.0-4.4] 4.2 [4.1-4.5] 4.3 [4.1-4.5] 4.4 [4.2-4.6] 4.5 [4.3-4.7] 4.6 [4.4-4.8] 4.6 [4.4-4.8] 4.6 [4.4-4.9]
Under-five mortality rate (probability of dying by age 5 per 1000 live births) 55.9 [49.3-63.3] 60.1 [54.4-66.4] 65.0 [59.4-71.1] 70.2 [64.1-76.8] 75.5 [69.1-82.3] 81.0 [74.6-87.7] 86.4 [80.1-93.0] 92.6 [86.2-99.4] 100.5 [93.6-107.7] 109.8 [102.7-117.3] 120.3 [112.8-128.3] 131.3 [123.5-139.6] 142.5 [133.9-151.3] 153.1 [143.8-162.6] 9.4 [9.1-9.8] 9.8 [9.5-10.1] 10.2 [9.9-10.5] 10.7 [10.3-11.0] 11.2 [10.8-11.5] 11.7 [11.4-12.1] 12.3 [12.0-12.7] 12.9 [12.5-13.2] 13.4 [13.1-13.8] 14.0 [13.6-14.3] 14.5 [13.9-15.0] 15.1 [14.3-15.8] 15.9 [14.8-16.8] 16.7 [15.4-18.0] 4.4 [4.3-4.6] 4.5 [4.4-4.6] 4.6 [4.5-4.7] 4.8 [4.7-4.9] 5.0 [4.9-5.1] 5.2 [5.1-5.3] 5.4 [5.3-5.5] 5.6 [5.5-5.7] 5.8 [5.6-5.9] 5.9 [5.8-6.0] 6.0 [5.9-6.2] 6.2 [6.0-6.3] 6.3 [6.1-6.4] 6.3 [6.2-6.5] 6.6 [6.4-6.9] 6.8 [6.6-7.0] 6.9 [6.8-7.1] 7.0 [6.9-7.2] 7.2 [7.1-7.3] 7.3 [7.2-7.5] 7.5 [7.4-7.6] 7.6 [7.5-7.8] 7.8 [7.6-7.9] 7.9 [7.7-8.0] 8.0 [7.8-8.1] 8.1 [7.9-8.2] 8.1 [8.0-8.3] 8.2 [8.1-8.4]
Contraceptive prevalence (%) 30 65.4 66.7 84 76.4 78.6

Tidy Dataset

getting_tidy <- merged_df[-(1),] %>% 
    gather(United_states,Values,2:57) %>% 
    mutate(Year=rep(unlist(lapply(2015:2002,function(x) rep(x,23))),4)) %>% 
    spread(X, Values) 
## Warning: attributes are not identical across measure variables;
## they will be dropped
kable(getting_tidy[1:10,])
United_states Year Antiretroviral therapy coverage among people with HIV infection eligible for ART according to 2010 guidelines (%) Cellular subscribers (per 100 population) Civil registration coverage of births (%) Contraceptive prevalence (%) Deaths due to tuberculosis among HIV-negative people (per 100 000 population) Gross national income per capita (PPP int. $) Hospital beds (per 10 000 population) Incidence of tuberculosis (per 100 000 population per year) Infant mortality rate (probability of dying between birth and age 1 per 1000 live births) Maternal mortality ratio (per 100 000 live births) Neonatal mortality rate (per 1000 live births) Number of infant deaths (thousands) Number of neonatal deaths (thousands) Number of under-five deaths (thousands) Poliomyelitis - number of reported cases Population living in urban areas (%) Population median age (years) Prevalence of HIV among adults aged 15 to 49 (%) Psychiatrists working in mental health sector (per 100,000) Total density per million population: Radiotherapy units Total fertility rate (per woman) Tuberculosis treatment coverage Under-five mortality rate (probability of dying by age 5 per 1000 live births)
Uganda 2015 NA NA NA NA 25 [14-40] NA NA 202 [120-304] 39.2 [35.4-43.3] 343 [ 247 - 493] 22.0 [18.4-26.2] 66 38 93 NA NA NA NA NA NA NA 52 [34-87] 55.9 [49.3-63.3]
Uganda.1 2014 NA NA NA NA 23 [13-35] NA NA 202 [127-294] 41.0 [37.8-44.5] NA 22.6 [19.4-26.4] 68 38 97 0 NA NA NA NA NA NA 56 [39-89] 60.1 [54.4-66.4]
Uganda.10 2005 NA NA NA NA 17 [9.5-28] 890 NA 233 [156-325] 74.4 [70.3-78.7] NA 28.3 [24.8-31.9] 99 38 155 NA NA NA 7.9 [7.3-8.4] NA NA NA 62 [44-92] 120.3 [112.8-128.3]
Uganda.11 2004 NA NA NA NA 16 [9.1-25] 840 NA 240 [169-323] 80.5 [76.3-85.0] NA 29.4 [25.8-33.0] 104 39 164 NA NA NA NA NA NA NA 66 [49-94] 131.3 [123.5-139.6]
Uganda.12 2003 NA NA NA NA 17 [9.6-27] 800 NA 248 [172-336] 86.7 [82.0-91.4] NA 30.5 [26.9-34.4] 109 39 173 NA NA NA NA NA NA NA 65 [48-94] 142.5 [133.9-151.3]
Uganda.13 2002 NA NA NA NA 19 [10-30] 760 NA 256 [171-358] 92.5 [87.5-97.5] NA 31.9 [28.1-35.9] 112 40 181 NA NA NA NA NA NA NA 62 [44-92] 153.1 [143.8-162.6]
Uganda.2 2013 NA NA NA NA 20 [12-31] NA NA 203 [134-288] 43.9 [40.8-47.2] NA 23.3 [20.1-26.8] 71 38 103 0 NA 15.8 NA NA 0.05 5.9 60 [42-91] 65.0 [59.4-71.1]
Uganda.3 2012 64 [57-71] 45 NA NA 19 [12-29] 1320 NA 205 [135-289] 46.5 [43.2-50.0] NA 23.9 [20.7-27.4] 73 38 109 NA NA 15.68 NA NA NA 5.96 60 [43-91] 70.2 [64.1-76.8]
Uganda.4 2011 NA 48 29.9 30 17 [11-26] 1310 NA 207 [143-283] 49.5 [46.1-53.3] NA 24.4 [21.3-27.9] 76 38 114 NA NA NA NA 0.09 NA 6.06 64 [47-92] 75.5 [69.1-82.3]
Uganda.5 2010 NA 38 NA NA 18 [10-29] 1240 5 210 [139-296] 52.7 [49.2-56.4] NA 24.9 [21.8-28.3] 79 38 119 NA 14.5 NA 7.4 [6.9-7.8] NA 0.06 NA 60 [43-91] 81.0 [74.6-87.7]

Get Rid Of Special Characters ] [ -

getting_tidy <-  as_data_frame(lapply(getting_tidy,function(x){ str_replace_all(x,"\\]|\\["," ")}))
getting_tidy <-  as_data_frame(lapply(getting_tidy,function(x){ str_replace_all(x,"-","  ")}))



final_df <- getting_tidy %>% 
    separate(.,`Incidence of tuberculosis (per 100 000 population per year)`,into=c('Mean_Incidence_Tuberculosis_100,000','Min_Tuberculosis',"Max_Tuberculosis")) %>% 
    separate(.,`Antiretroviral therapy coverage among people with HIV infection eligible for ART according to 2010 guidelines (%)`,into=c('Mean_Antiretroviral_coverage','Min_Antiretroviral_coverage','Max_Antiretroviral_coverage')) %>% 
    separate(.,`Infant mortality rate (probability of dying between birth and age 1 per 1000 live births)`,into=c('Mean_Infant mortality_Rate/1000','Min_Infant_Mortality rate',"Max_Infant_Mortality_Rate"),sep= "  ") %>% 
    separate(.,`Under-five mortality rate (probability of dying by age 5 per 1000 live births)`,into=c('Mean_Under-five_Mortality_Rate/1000','Min_Under-five_Mortality_Rate',"Max_Under-five_Mortality_Rate"), sep="  ") %>% 
    separate(.,`Tuberculosis treatment coverage`,into=c('Mean_Tuberculosis_Coverage','Min_Tuberculosis_Coverage',"Max_Tuberculosis_Coverage"))
## Warning: Expected 3 pieces. Additional pieces discarded in 56 rows [1, 2,
## 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
## Warning: Expected 3 pieces. Additional pieces discarded in 2 rows [8, 22].
## Warning: Expected 3 pieces. Missing pieces filled with `NA` in 2 rows [36,
## 50].
## Warning: Expected 3 pieces. Additional pieces discarded in 55 rows [1, 2,
## 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, ...].
## Warning: Expected 3 pieces. Missing pieces filled with `NA` in 1 rows [18].

More Piping

final_df %<>% 
    plyr::rename(.,c('United_states'= 'Country')) %>% 
    mutate(Country=rep(c("Uganda","Ukraine","United_Kingdom","United_States"),each=14)) %>% 
    select(colnames(.)[c(1,2,10,11,12,13,14,15,16,17,21,22,23,30,31,32,33,34,35)]) %>% 
    arrange(.,`Country`)  

final_df[] <- lapply(final_df,function(x){ str_trim(x)}) 
final_df[3:19] <- lapply(final_df[3:19],function(x) as.numeric(as.character(x))) 
## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion
final_df <- as_data_frame(final_df)
kable(final_df)
Country Year Gross national income per capita (PPP int. $) Hospital beds (per 10 000 population) Mean_Incidence_Tuberculosis_100,000 Min_Tuberculosis Max_Tuberculosis Mean_Infant mortality_Rate/1000 Min_Infant_Mortality rate Max_Infant_Mortality_Rate Number of neonatal deaths (thousands) Number of under-five deaths (thousands) Poliomyelitis - number of reported cases Mean_Tuberculosis_Coverage Min_Tuberculosis_Coverage Max_Tuberculosis_Coverage Mean_Under-five_Mortality_Rate/1000 Min_Under-five_Mortality_Rate Max_Under-five_Mortality_Rate
Uganda 2015 NA NA 202 120 304 39.2 35.4 43.3 38 93 NA 52 34 87 55.9 49.3 63.3
Uganda 2014 NA NA 202 127 294 41.0 37.8 44.5 38 97 0 56 39 89 60.1 54.4 66.4
Uganda 2005 890 NA 233 156 325 74.4 70.3 78.7 38 155 NA 62 44 92 120.3 112.8 128.3
Uganda 2004 840 NA 240 169 323 80.5 76.3 85.0 39 164 NA 66 49 94 131.3 123.5 139.6
Uganda 2003 800 NA 248 172 336 86.7 82.0 91.4 39 173 NA 65 48 94 142.5 133.9 151.3
Uganda 2002 760 NA 256 171 358 92.5 87.5 97.5 40 181 NA 62 44 92 153.1 143.8 162.6
Uganda 2013 NA NA 203 134 288 43.9 40.8 47.2 38 103 0 60 42 91 65.0 59.4 71.1
Uganda 2012 1320 NA 205 135 289 46.5 43.2 50.0 38 109 NA 60 43 91 70.2 64.1 76.8
Uganda 2011 1310 NA 207 143 283 49.5 46.1 53.3 38 114 NA 64 47 92 75.5 69.1 82.3
Uganda 2010 1240 5 210 139 296 52.7 49.2 56.4 38 119 NA 60 43 91 81.0 74.6 87.7
Uganda 2009 1200 4 213 140 302 55.7 52.2 59.3 38 124 NA 60 42 91 86.4 80.1 93.0
Uganda 2008 1150 NA 217 145 304 58.9 55.4 62.5 38 130 NA 61 44 92 92.6 86.2 99.4
Uganda 2007 1070 NA 222 146 313 63.3 59.6 67.3 38 137 NA 60 43 92 100.5 93.6 107.7
Uganda 2006 990 NA 227 150 319 68.6 64.7 72.7 38 145 NA 61 43 92 109.8 102.7 117.3
Ukraine 2015 NA NA 91 59 130 8.1 7.8 8.4 3 5 NA 74 52 110 9.4 9.1 9.8
Ukraine 2014 NA NA 94 61 135 8.4 8.1 8.7 3 5 0 75 52 120 9.8 9.5 10.1
Ukraine 2005 6410 87 127 82 181 12.5 12.0 12.9 4 6 NA 67 47 100 14.5 13.9 15.0
Ukraine 2004 6000 87 127 82 182 13.0 12.3 13.6 4 6 NA NA NA NA 15.1 14.3 15.8
Ukraine 2003 5170 88 126 81 180 13.7 12.8 14.5 4 6 NA 130 91 200 15.9 14.8 16.8
Ukraine 2002 4590 89 123 80 176 14.3 13.2 15.4 4 7 NA 68 48 110 16.7 15.4 18.0
Ukraine 2013 NA 88 96 62 138 8.8 8.5 9.0 3 5 0 84 59 130 10.2 9.9 10.5
Ukraine 2012 8670 89 101 65 144 9.2 8.9 9.4 3 5 NA 90 63 140 10.7 10.3 11.0
Ukraine 2011 8170 90 105 68 150 9.6 9.3 9.9 3 5 NA 71 50 110 11.2 10.8 11.5
Ukraine 2010 7590 94 110 71 157 10.1 9.8 10.4 3 6 NA 67 47 100 11.7 11.4 12.1
Ukraine 2009 7130 94 115 74 164 10.6 10.3 10.9 4 6 NA 68 48 110 12.3 12.0 12.7
Ukraine 2008 8370 87 119 77 170 11.1 10.8 11.4 4 6 NA 69 48 110 12.9 12.5 13.2
Ukraine 2007 7930 87 123 79 175 11.6 11.3 11.9 4 6 NA 66 46 100 13.4 13.1 13.8
Ukraine 2006 7110 87 125 81 179 12.0 11.7 12.3 4 6 NA 71 49 110 14.0 13.6 14.3
United_Kingdom 2015 NA NA 10 9 1 3.7 3.6 3.9 2 4 NA 89 81 98 4.4 4.3 4.6
United_Kingdom 2014 NA NA 11 10 13 3.8 3.7 3.9 2 4 0 89 81 98 4.5 4.4 4.6
United_Kingdom 2005 33820 37 15 14 17 5.1 5.0 5.2 3 4 NA 89 81 98 6.0 5.9 6.2
United_Kingdom 2004 32430 39 13 12 15 5.3 5.2 5.4 2 4 NA 89 81 98 6.2 6.0 6.3
United_Kingdom 2003 30450 40 13 12 15 5.4 5.3 5.4 2 4 NA 89 81 98 6.3 6.1 6.4
United_Kingdom 2002 29390 40 13 12 14 5.4 5.3 5.5 2 4 NA 89 81 98 6.3 6.2 6.5
United_Kingdom 2013 NA 28 13 12 14 3.9 3.8 4.0 2 4 0 89 81 98 4.6 4.5 4.7
United_Kingdom 2012 34640 28 14 13 16 4.1 4.0 4.2 2 4 NA 89 81 98 4.8 4.7 4.9
United_Kingdom 2011 35270 29 15 13 16 4.2 4.2 4.3 2 4 NA 89 81 98 5.0 4.9 5.1
United_Kingdom 2010 34510 30 14 13 15 4.4 4.3 4.5 2 4 NA 89 81 98 5.2 5.1 5.3
United_Kingdom 2009 35260 33 15 13 16 4.6 4.5 4.7 2 4 NA 89 81 98 5.4 5.3 5.5
United_Kingdom 2008 37110 34 15 13 16 4.8 4.7 4.9 2 4 NA 89 81 98 5.6 5.5 5.7
United_Kingdom 2007 36480 34 15 13 16 4.9 4.8 5.0 3 4 NA 89 81 98 5.8 5.6 5.9
United_Kingdom 2006 35620 36 15 14 17 5.0 4.9 5.1 3 4 NA 89 81 98 5.9 5.8 6.0
United_States 2015 NA NA 3 3 2 5.7 5.4 5.9 15 26 NA 87 75 100 6.6 6.4 6.9
United_States 2014 NA NA 3 2 2 5.8 5.7 6.0 16 27 0 87 75 100 6.8 6.6 7.0
United_States 2005 44740 NA 5 5 4 6.8 6.7 6.9 19 33 NA 87 75 100 8.0 7.8 8.1
United_States 2004 42260 NA 5 7 4 6.9 6.8 7.0 19 33 NA 87 75 100 8.1 7.9 8.2
United_States 2003 39960 NA 5 9 5 6.9 6.7 7.0 19 33 NA 87 75 100 8.1 8.0 8.3
United_States 2002 38590 NA 6 5 2 6.9 6.8 7.0 19 33 NA 87 75 100 8.2 8.1 8.4
United_States 2013 NA 29 3 3 2 5.9 5.8 6.0 16 27 0 87 75 100 6.9 6.8 7.1
United_States 2012 52620 29 3 7 3 6.0 5.9 6.1 16 28 NA 87 75 100 7.0 6.9 7.2
United_States 2011 50860 29 3 9 3 6.1 6.0 6.3 16 29 NA 87 75 100 7.2 7.1 7.3
United_States 2010 48880 30 4 2 3 6.2 6.1 6.3 17 30 NA 87 75 100 7.3 7.2 7.5
United_States 2009 47240 31 4 3 3 6.4 6.3 6.5 17 31 NA 87 75 100 7.5 7.4 7.6
United_States 2008 48650 NA 4 9 4 6.5 6.4 6.6 17 31 NA 87 75 100 7.6 7.5 7.8
United_States 2007 48420 NA 5 1 4 6.6 6.5 6.7 18 32 NA 87 75 100 7.8 7.6 7.9
United_States 2006 47390 NA 5 3 4 6.7 6.6 6.8 18 33 NA 87 75 100 7.9 7.7 8.0

Visual Exploratory Analysis Of Infant Mortality

final_df %>%
    mutate(GNP=as.numeric(`Gross national income per capita (PPP int. $)`)) %>% 
    dplyr::group_by(Country) %>% 
    ggplot(., aes(x=Year ,y=GNP))+ 
    geom_bar(aes(fill = Country), position = "dodge", stat = "identity")+
    theme(axis.text.x=element_text(angle=45,hjust=1))+
    labs(title="GNP By Year")
## Warning: Removed 12 rows containing missing values (geom_bar).

final_df %>%
    dplyr::group_by(Country) %>% 
    ggplot(., aes(x=Year ,y=`Mean_Infant mortality_Rate/1000`))+ 
    geom_bar(aes(fill = Country), position = "dodge", stat = "identity")+
    theme(axis.text.x=element_text(angle=45,hjust=1))

final_df_display <- final_df %>% 
    arrange(Country,Year) %>% 
    select(.,Country,`Mean_Infant mortality_Rate/1000`)

Numerical Display Of Infant Mortality

## Numerical display     
kable(final_df_display)
Country Mean_Infant mortality_Rate/1000
Uganda 92.5
Uganda 86.7
Uganda 80.5
Uganda 74.4
Uganda 68.6
Uganda 63.3
Uganda 58.9
Uganda 55.7
Uganda 52.7
Uganda 49.5
Uganda 46.5
Uganda 43.9
Uganda 41.0
Uganda 39.2
Ukraine 14.3
Ukraine 13.7
Ukraine 13.0
Ukraine 12.5
Ukraine 12.0
Ukraine 11.6
Ukraine 11.1
Ukraine 10.6
Ukraine 10.1
Ukraine 9.6
Ukraine 9.2
Ukraine 8.8
Ukraine 8.4
Ukraine 8.1
United_Kingdom 5.4
United_Kingdom 5.4
United_Kingdom 5.3
United_Kingdom 5.1
United_Kingdom 5.0
United_Kingdom 4.9
United_Kingdom 4.8
United_Kingdom 4.6
United_Kingdom 4.4
United_Kingdom 4.2
United_Kingdom 4.1
United_Kingdom 3.9
United_Kingdom 3.8
United_Kingdom 3.7
United_States 6.9
United_States 6.9
United_States 6.9
United_States 6.8
United_States 6.7
United_States 6.6
United_States 6.5
United_States 6.4
United_States 6.2
United_States 6.1
United_States 6.0
United_States 5.9
United_States 5.8
United_States 5.7

Display Of Infant Mortality With The 3 Samples Closer In Scale

final_df %>%
    dplyr::filter(., Country %in% c("United_Kingdom", "Ukraine","United_States")) %>% 
    dplyr::group_by(Country) %>% 
    ggplot(., aes(x=Year ,y=`Mean_Infant mortality_Rate/1000`))+ 
    geom_bar(aes(fill = Country), position = "dodge", stat = "identity")+
    theme(axis.text.x=element_text(angle=45,hjust=1))

final_df
## # A tibble: 56 x 19
##    Coun~ Year  `Gro~ `Hos~ `Mea~ Min_~ Max_~ `Mea~ `Min~ Max_~ `Num~ `Num~
##    <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1 Ugan~ 2015     NA NA      202   120   304  39.2  35.4  43.3  38.0  93.0
##  2 Ugan~ 2014     NA NA      202   127   294  41.0  37.8  44.5  38.0  97.0
##  3 Ugan~ 2005    890 NA      233   156   325  74.4  70.3  78.7  38.0 155  
##  4 Ugan~ 2004    840 NA      240   169   323  80.5  76.3  85.0  39.0 164  
##  5 Ugan~ 2003    800 NA      248   172   336  86.7  82.0  91.4  39.0 173  
##  6 Ugan~ 2002    760 NA      256   171   358  92.5  87.5  97.5  40.0 181  
##  7 Ugan~ 2013     NA NA      203   134   288  43.9  40.8  47.2  38.0 103  
##  8 Ugan~ 2012   1320 NA      205   135   289  46.5  43.2  50.0  38.0 109  
##  9 Ugan~ 2011   1310 NA      207   143   283  49.5  46.1  53.3  38.0 114  
## 10 Ugan~ 2010   1240  5.00   210   139   296  52.7  49.2  56.4  38.0 119  
## # ... with 46 more rows, and 7 more variables: `Poliomyelitis - number of
## #   reported cases` <dbl>, Mean_Tuberculosis_Coverage <dbl>,
## #   Min_Tuberculosis_Coverage <dbl>, Max_Tuberculosis_Coverage <dbl>,
## #   `Mean_Under-five_Mortality_Rate/1000` <dbl>,
## #   `Min_Under-five_Mortality_Rate` <dbl>, `Max_Under-five_Mortality_Rate`
## #   <dbl>

Look At Tuberculosis

final_df
## # A tibble: 56 x 19
##    Coun~ Year  `Gro~ `Hos~ `Mea~ Min_~ Max_~ `Mea~ `Min~ Max_~ `Num~ `Num~
##    <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1 Ugan~ 2015     NA NA      202   120   304  39.2  35.4  43.3  38.0  93.0
##  2 Ugan~ 2014     NA NA      202   127   294  41.0  37.8  44.5  38.0  97.0
##  3 Ugan~ 2005    890 NA      233   156   325  74.4  70.3  78.7  38.0 155  
##  4 Ugan~ 2004    840 NA      240   169   323  80.5  76.3  85.0  39.0 164  
##  5 Ugan~ 2003    800 NA      248   172   336  86.7  82.0  91.4  39.0 173  
##  6 Ugan~ 2002    760 NA      256   171   358  92.5  87.5  97.5  40.0 181  
##  7 Ugan~ 2013     NA NA      203   134   288  43.9  40.8  47.2  38.0 103  
##  8 Ugan~ 2012   1320 NA      205   135   289  46.5  43.2  50.0  38.0 109  
##  9 Ugan~ 2011   1310 NA      207   143   283  49.5  46.1  53.3  38.0 114  
## 10 Ugan~ 2010   1240  5.00   210   139   296  52.7  49.2  56.4  38.0 119  
## # ... with 46 more rows, and 7 more variables: `Poliomyelitis - number of
## #   reported cases` <dbl>, Mean_Tuberculosis_Coverage <dbl>,
## #   Min_Tuberculosis_Coverage <dbl>, Max_Tuberculosis_Coverage <dbl>,
## #   `Mean_Under-five_Mortality_Rate/1000` <dbl>,
## #   `Min_Under-five_Mortality_Rate` <dbl>, `Max_Under-five_Mortality_Rate`
## #   <dbl>
final_df %>%
    dplyr::filter(., Country %in% c("Uganda", "Ukraine","United_Kingdom","United_States")) %>% 
    dplyr::group_by(Country) %>% 
    ggplot(., aes(x=Year ,y=`Mean_Incidence_Tuberculosis_100,000`))+ 
    geom_bar(aes(fill = Country), position = "dodge", stat = "identity")+
    theme(axis.text.x=element_text(angle=45,hjust=1))

Look At Tuberculosis In Heavily Industrialized Nations( UK, US)

final_df %>%
    dplyr::filter(., Country %in% c("United_Kingdom","United_States")) %>% 
    dplyr::group_by(Country) %>% 
    ggplot(., aes(x=Year ,y=`Mean_Incidence_Tuberculosis_100,000`))+ 
    geom_bar(aes(fill = Country), position = "dodge", stat = "identity")+
    theme(axis.text.x=element_text(angle=45,hjust=1))