0.1 Data Cleaning

0.2 Visualizations

my_colors <-  c("#04536e", "#7c2817", "#f15c42", "#3d6a51", "#eca324","#5C92A1")
my_font <- "Ubuntu Condensed"

df %>% 
  select(year, countries, gov_exp) %>% 
  group_by(year, countries) %>% 
  summarise( mean = mean(gov_exp)) ->p
#==================== Geom_text_________ 
p %>% 
  filter(countries %in% c("Middle East")) %>% 
  filter (year == 2013)-> df_middle 



p %>% 
  filter(countries %in% c("Northest Asia", "Southest Asia")) %>% 
  filter (year == 2013 )-> df_Asias 


p %>% 
  filter(countries %in% c("Northen", "United & Europe")) %>% 
  filter (year == 2013 )-> df_europe 

p %>% 
  filter(countries %in% c("Others")) %>% 
  filter (year == 2013 )-> Others 
  
p %>% 
ggplot(aes(year, mean, group=countries, color=countries))+
  geom_line(size=1.3, show.legend = FALSE)+
  scale_color_manual(values = my_colors)+
  scale_fill_manual(values=my_colors)+
  scale_x_continuous(limits = c(1995, 2014), breaks = seq(1995,2014,2))+
  
  
  geom_text(data=df_middle, aes(year, mean, label=countries),
            size=5, hjust= 0, vjust=2.5,family= my_font, show.legend = FALSE)+
  geom_text(data=df_Asias, aes(year, mean, label=countries),
            size=5, hjust= 0, vjust= 1, family= my_font, show.legend = FALSE)+
  geom_text(data=df_europe, aes(year, mean, label=countries),
            size=5, hjust= 0, vjust= 1,family= my_font, show.legend = FALSE)+
  geom_text(data=Others, aes(year, mean, label=countries),
            size=5, hjust= 0, vjust= - 1,family= my_font, show.legend = FALSE)+
  theme_economist()+
  
  theme(panel.grid.minor = element_blank())+
   labs(x = NULL, y = NULL, 
       title = "World Governement's Composition of Expenditure on Health Care: 1995 - 2014", 
       subtitle = "Expenditure is calculated according to Purchasing Power Parity in 2010.", 
       caption = "Data Source: World Health Organization (WHO)") + 
  theme(plot.title = element_text(family = my_font, size = 15, colour = "grey10")) + 
  theme(plot.subtitle = element_text(family = my_font, size = 10, colour = "grey20")) + 
  theme(plot.caption = element_text(family = my_font, size = 10, colour = "grey30", face = "italic")) + 
  theme(legend.text = element_text(size = 10, color = "grey10", family = my_font)) + 
  theme(legend.position = c(0.15, 0.8)) + 
  theme(plot.margin = unit(c(1.2, 1.2, 1.2, 1.2), "cm"))

## # A tibble: 40 x 8
##     year country      gov_exp total_exp private gov_rate countries     priv_rate
##    <dbl> <chr>          <dbl>     <dbl>   <dbl>    <dbl> <fct>             <dbl>
##  1  2014 South Korea    1368.     2531.   1163.    0.541 Northest Asia     0.459
##  2  2014 United Stat~   4541.     9403.   4861.    0.483 United & Eur~     0.517
##  3  2013 South Korea    1293.     2380.   1087.    0.543 Northest Asia     0.457
##  4  2013 United Stat~   4279.     8988.   4709.    0.476 United & Eur~     0.524
##  5  2012 South Korea    1233.     2246.   1012.    0.549 Northest Asia     0.451
##  6  2012 United Stat~   4154.     8790.   4636.    0.473 United & Eur~     0.527
##  7  2011 South Korea    1197.     2140.    943.    0.559 Northest Asia     0.441
##  8  2011 United Stat~   4035.     8524.   4489.    0.473 United & Eur~     0.527
##  9  2010 South Korea    1174.     2070.    895.    0.567 Northest Asia     0.433
## 10  2010 United Stat~   3926.     8269.   4343.    0.475 United & Eur~     0.525
## # ... with 30 more rows

## # A tibble: 20 x 7
##    year  gov_exp total_exp private gov_rate         countries    priv_rate      
##    <fct>   <dbl>     <dbl>   <dbl> <fct>            <fct>        <fct>          
##  1 2014    1368.     2531.   1163. 0.5405106359436~ Northest As~ 0.459489364056~
##  2 2013    1293.     2380.   1087. 0.5432691095781~ Northest As~ 0.456730890421~
##  3 2012    1233.     2246.   1012. 0.54925519360513 Northest As~ 0.450744806394~
##  4 2011    1197.     2140.    943. 0.55928948856071 Northest As~ 0.440710511439~
##  5 2010    1174.     2070.    895. 0.5674090535774~ Northest As~ 0.432590946422~
##  6 2009    1066.     1890.    823. 0.5643116421322~ Northest As~ 0.435688357867~
##  7 2008     966.     1768.    802. 0.5463335745951~ Northest As~ 0.453666425404~
##  8 2007     914.     1669.    755. 0.5477607378508~ Northest As~ 0.452239262149~
##  9 2006     814.     1489.    675. 0.5463911294384~ Northest As~ 0.453608870561~
## 10 2005     683.     1291.    608. 0.5289450234396~ Northest As~ 0.471054976560~
## 11 2004     598.     1139.    541. 0.5252137727599~ Northest As~ 0.474786227240~
## 12 2003     549.     1054.    504. 0.52136192347486 Northest As~ 0.478638076525~
## 13 2002     519.      959.    440. 0.5411638313185~ Northest As~ 0.458836168681~
## 14 2001     505.      914.    409. 0.5523101840705~ Northest As~ 0.447689815929~
## 15 2000     374.      765.    390. 0.4896867438362~ Northest As~ 0.510313256163~
## 16 1999     334.      689.    355. 0.4845392253643~ Northest As~ 0.515460774635~
## 17 1998     278.      580.    303. 0.4782518784035~ Northest As~ 0.521748121596~
## 18 1997     257.      598.    341. 0.4295502782559~ Northest As~ 0.570449721744~
## 19 1996     227.      561.    334. 0.4042837779997~ Northest As~ 0.595716222000~
## 20 1995     185.      493.    308. 0.37528905837965 Northest As~ 0.624710941620~