Executive Summary

knitr::include_graphics("globalecon.jpeg")


Pace of Global Economy: Developed Countries vs. Developing Countries

The World Economy trend has beening changing constantly. This project analyzes the economic growing trend in most recent 15 years of both developed and developing (BRICS) countries.

Developing countries perform well in many indicators such as GDP growth rate and import & export value index, which show great development potential.

However, considering life quality, there is still a large gap existed between developed and developing countries, such as households expenditure per capita, internet ultilization. Large population in China and India contributes to fast economy growth while negatively affect living environment.

GDP per capita growth (annual %)

colourPalette <- RColorBrewer::brewer.pal(4,"YlGnBu")

mapParams <- mapCountryData(sPDF
,nameColumnToPlot="GDPGrowth"
,addLegend=FALSE
,catMethod="quantiles"
,colourPalette=colourPalette
,mapTitle="2017 GDP Growth by Country")

mapParams$legendText <- c('less than 0','0 to 10','10 to 20','more than 20')
do.call(addMapLegendBoxes, c(mapParams,title="Number of Refugees",horiz=TRUE, x = "bottom", cex = 0.75, pt.cex = 1.5))


GDP Growth:

Comparison of GDP Growth of Developed vs. Developing Countries

developed_gdp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedgdp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'GDP Growth for Developed Countries', x = 'year', y = 'GDP Growth %') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_gdp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developinggdp) + 
    geom_line(aes(color=Country.Name)) +
  geom_point(aes(color=Country.Name)) +
    labs(title = 'GDP Growth for Developing Countries', x = 'year', y = 'GDP Growth %') +
       theme_minimal() + 
      theme(legend.position='top') +
   guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_gdp,developing_gdp, ncol = 1, nrow = 2)

*** GDP per capita growth (annual %) Comparison

Generally, developed countries experienced more stable GDP growth than developing countries. However, developed countries suffered more during the financial crisis from 2008 to 2011.

BRICS countries have enjoyed continuous growth until Global Financial Crisis in 2008. After that, the growth rate was slower year by year and South Africa and Brazil experience negative GDP growth in most recent two years.

Comparison of households expenditure of Developed vs. Developing Countries

developed_exp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedexp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Households Expenditure per Capita for Developed Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_exp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developingexp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Households Expenditure per Capita for Developing Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_exp,developing_exp, ncol = 1, nrow = 2)

*** Households Expenditure per capita growth (annual %) Comparison

Developed countries enjoy significant higher households expenditure per capita than developing countries and households expenditure in developing countries is growing steadily since 2000.

Among BRICS countries, Brazil and South Africa has relative high households expenditure while China and India experience very low households expenditure per capita caused by large population.

Comparison of Urban Population Growth of Developed vs. Developing Countries

developed_pop <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedpop) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Urban Population Growth  for Developed Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_pop <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developingpop) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Urban Population Growth for Developing Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_pop,developing_pop, ncol = 1, nrow = 2)


Urban Population growth (annual %) Comparison

Developed countries have stable urban population growth since 2011 while developing countries urban population grow in a decreasing rate. Many young people move into suburban areas or big cities in the developing countries.

Comparison of Internet Usage of Developed vs. Developing Countries

developed_internet <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedinternet) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = '% of Popupation Using Internet of Developed Countries', x = 'year', y = '% of Popupation Using Internet') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_internet <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developinginternet) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = '% of Popupation Using Internet of Developing Countries', x = 'year', y = '% of Popupation Using Internet') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_internet,developing_internet, ncol = 1, nrow = 2)


% Population Using Internet Comparison

Developed countries have average around 70% of population having access to Internt while the percentage is around 50% in most of BRICS countries except India.

Overall, Internet usage rate has been increasing since 2000. This indicates more of technology is involved in each country’s development strategy.

Comparison of Import Value of Developed vs. Developing Countries

developed_import <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedimport) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'Import Value Index of Developed Countries', x = 'year', y = 'Import Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_import <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingimport) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = 'Import Value Index of Developing Countries', x = 'year', y = 'Import Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_import,developing_import,ncol = 1, nrow = 2)


Import Comparison

Developing countries beat developed countries in Import Value Index, especially China and India.

Comparison of Export Value of Developed vs. Developing Countries

developed_export <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedexport) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'Export Value Index of Developed Countries', x = 'year', y = 'Export Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_export <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingexport) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = 'Export Value Index of Developing Countries', x = 'year', y = 'Export Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_export,developing_export,ncol = 1, nrow = 2)

*** Export Comparison

Developing countries beat developed countries in Export Value Index, especially China and India.

Comparison of High-tech Export of Developed vs. Developing Countries

developed_tech <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedtech) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'High-technology exports (% of manufactured exports) in Developed Countries', x = 'year', y = '% High-tech Export') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")
      
developing_tech <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingtech) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'High-technology exports (% of manufactured exports) in of Developing Countries', x = 'year', y = '% High-tech Export') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_tech,developing_tech,ncol = 1, nrow = 2)


High-Technology Export Comparison

Generally, developed Countries have sigfinicant higher proportion of High-Techolology export comparing with BRICS countries. China is an exception which has comparable proportion of high-tech export as United States.

---
title: "ANLY 512 Narrative Vis Lab WDI"
author: "Xiaoxi Yang"
date: "July 14, 2018"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    storyboard: true
    vertical_layout: fill
    social: menu
    source_code: embed
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(flexdashboard)
library(dplyr)
library(reshape2)
library(ggplot2)
library(plotly)
library(ggthemes)
library(GGally)
library(gridExtra)
library(rworldmap)
library(scales)
library(RColorBrewer)

wdidata1 <- read.csv('WDIData.csv', header = TRUE, stringsAsFactors = FALSE)
wdidata1 <- as.data.frame(wdidata1)

colnames(wdidata1)[1] <- 'Country.Name'
colnames(wdidata1)[3] <- 'Indicator.Name'
colnames(wdidata1)[5:length(colnames(wdidata1))] <- gsub(pattern = 'X', replacement = '', x = colnames(wdidata1)[5:length(colnames(wdidata1))]) 
indicators <- c('GDP per capita growth (annual %)',
               'Households and NPISHs Final consumption expenditure per capita (constant 2010 US$)',
               'Access to electricity (% of population)', 
               'Individuals using the Internet (% of population)',
               'Urban population growth (annual %)',
               'Import value index (2000 = 100)',
               'Export value index (2000 = 100)',
               'High-technology exports (% of manufactured exports)')
developing<-c('Brazil','India','South Africa','China')
developed<-c('Japan','United States','European Union','Australia','Canada')
countries <- c(developing, developed,'World')

wdidata1 <- wdidata1[1:(length(colnames(wdidata1))-1)]
wdidata2 <- subset(wdidata1, select = -c(Country.Code, Indicator.Code))
wdi<- wdidata2 %>% 
  filter(Indicator.Name %in% indicators, Country.Name %in% countries) %>%
  melt(id = c('Country.Name', 'Indicator.Name'),value.name = "Value",
    variable.name = ("Year"))

mapdata <- read.csv('MapData.csv', header = TRUE, stringsAsFactors = FALSE)

sPDF <- joinCountryData2Map(mapdata
, joinCode='NAME'
, nameJoinColumn='CountryName'
, verbose='TRUE')

developedgdp <- wdi %>% 
  filter(Indicator.Name %in%'GDP per capita growth (annual %)', Country.Name %in% developed)

developinggdp <- wdi %>% 
  filter(Indicator.Name %in%'GDP per capita growth (annual %)', Country.Name %in% developing)

developedexp <- wdi %>% 
  filter(Indicator.Name %in%'Households and NPISHs Final consumption expenditure per capita (constant 2010 US$)', Country.Name %in% developed)
developingexp <- wdi %>% 
  filter(Indicator.Name %in%'Households and NPISHs Final consumption expenditure per capita (constant 2010 US$)', Country.Name %in% developing)

developedpop <- wdi %>% 
  filter(Indicator.Name %in%'Urban population growth (annual %)', Country.Name %in% developed)
developingpop <- wdi %>% 
  filter(Indicator.Name %in%'Urban population growth (annual %)', Country.Name %in% developing)

developedinter <- wdi %>% 
  filter(Indicator.Name %in%'Individuals using the Internet (% of population)', Country.Name %in% developed)
developedinter[, 3] <- as.numeric(as.character(developedinter[, 3] ))
developedinternet <- subset(developedinter, Year > 2013)
developinginter <- wdi %>% 
  filter(Indicator.Name %in%'Individuals using the Internet (% of population)', Country.Name %in% developing)
developinginter[, 3] <- as.numeric(as.character(developinginter[, 3] ))
developinginternet <- subset(developinginter, Year > 2013)

developedimp <- wdi %>% 
  filter(Indicator.Name %in%'Import value index (2000 = 100)', Country.Name %in% developed)
developedimp[, 3] <- as.numeric(as.character(developedimp[, 3] ))
developedimport <- subset(developedimp, Year > 2013)
developedimport <- na.omit(developedimport)
developingimp <- wdi %>% 
  filter(Indicator.Name %in%'Import value index (2000 = 100)', Country.Name %in% developing)
developingimp[, 3] <- as.numeric(as.character(developingimp[, 3] ))
developingimport <- subset(developingimp, Year > 2013)
developingimport <- na.omit(developingimport)

developedexpr <- wdi %>% 
  filter(Indicator.Name %in%'Export value index (2000 = 100)', Country.Name %in% developed)
developedexpr[, 3] <- as.numeric(as.character(developedexpr[, 3] ))
developedexport <- subset(developedexpr, Year > 2013)
developedexport <- na.omit(developedexport)
developingexpr <- wdi %>% 
  filter(Indicator.Name %in%'Export value index (2000 = 100)', Country.Name %in% developing)
developingexpr[, 3] <- as.numeric(as.character(developingexpr[, 3] ))
developingexport <- subset(developingexpr, Year > 2013)
developingexport <- na.omit(developingexport)
 
developedtech <- wdi %>% 
  filter(Indicator.Name %in%'High-technology exports (% of manufactured exports)', Country.Name %in% developed)
developedtech[, 3] <- as.numeric(as.character(developedtech[, 3] ))
developedtech <- subset(developedtech, Year > 2013)
developedtech <- na.omit(developedtech)
developingtech <- wdi %>% 
  filter(Indicator.Name %in%'High-technology exports (% of manufactured exports)', Country.Name %in% developing)
developingtech[, 3] <- as.numeric(as.character(developingtech[, 3] ))
developingtech <- subset(developingtech, Year > 2013)
developingtech <- na.omit(developingtech)

```

### Executive Summary

```{r, message=FALSE, warning=FALSE}
knitr::include_graphics("globalecon.jpeg")
```

***
Pace of Global Economy: Developed Countries vs. Developing Countries

The World Economy trend has beening changing constantly. This project analyzes the economic growing trend in most recent 15 years of both developed and developing (BRICS) countries. 

Developing countries perform well in many indicators such as GDP growth rate and import & export value index, which show great development potential.

However, considering life quality, there is still a large gap existed between developed and developing countries, such as households expenditure per capita, internet ultilization. Large population in China and India contributes to fast economy growth while negatively affect living environment.


### GDP per capita growth (annual %)
```{r, message=FALSE, warning=FALSE}
colourPalette <- RColorBrewer::brewer.pal(4,"YlGnBu")

mapParams <- mapCountryData(sPDF
,nameColumnToPlot="GDPGrowth"
,addLegend=FALSE
,catMethod="quantiles"
,colourPalette=colourPalette
,mapTitle="2017 GDP Growth by Country")

mapParams$legendText <- c('less than 0','0 to 10','10 to 20','more than 20')
do.call(addMapLegendBoxes, c(mapParams,title="Number of Refugees",horiz=TRUE, x = "bottom", cex = 0.75, pt.cex = 1.5))
```

***
GDP Growth: 

- Developed countries like United States and EU show moderate GDP growth in 2017. 

- GDP in China and India have been growing faster than most of countries. 


### Comparison of GDP Growth of Developed vs. Developing Countries
```{r}
developed_gdp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedgdp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'GDP Growth for Developed Countries', x = 'year', y = 'GDP Growth %') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_gdp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developinggdp) + 
    geom_line(aes(color=Country.Name)) +
  geom_point(aes(color=Country.Name)) +
    labs(title = 'GDP Growth for Developing Countries', x = 'year', y = 'GDP Growth %') +
       theme_minimal() + 
      theme(legend.position='top') +
   guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_gdp,developing_gdp, ncol = 1, nrow = 2)
```
***
GDP per capita growth (annual %) Comparison

Generally, developed countries experienced more stable GDP growth than developing countries. However, developed countries suffered more during the financial crisis from 2008 to 2011.

BRICS countries have enjoyed continuous growth until Global Financial Crisis in 2008. After that, the growth rate was slower year by year and South Africa and Brazil experience negative GDP growth in most recent two years.


### Comparison of households expenditure of Developed vs. Developing Countries
```{r}
developed_exp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedexp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Households Expenditure per Capita for Developed Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_exp <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developingexp) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Households Expenditure per Capita for Developing Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_exp,developing_exp, ncol = 1, nrow = 2)
```
***
Households Expenditure per capita growth (annual %) Comparison

Developed countries enjoy significant higher households expenditure per capita than developing countries and households expenditure in developing countries is growing steadily since 2000.

Among BRICS countries, Brazil and South Africa has relative high households expenditure while China and India experience very low households expenditure per capita caused by large population.

### Comparison of Urban Population Growth of Developed vs. Developing Countries
```{r}
developed_pop <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developedpop) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Urban Population Growth  for Developed Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developed Countries")) 

developing_pop <- ggplot(aes(x=Year, y=Value, group=Country.Name), data=developingpop) + 
    geom_line(aes(color=Country.Name))+
  geom_point(aes(color=Country.Name)) +
    labs(title = 'Urban Population Growth for Developing Countries', x = 'year', y = '%') +
      theme_minimal() + 
      theme(legend.position='top') +
    guides(color=guide_legend(title="Developing Countries")) 

grid.arrange(developed_pop,developing_pop, ncol = 1, nrow = 2)
```

***
Urban Population growth (annual %) Comparison

Developed countries have stable urban population growth since 2011 while developing countries urban population grow in a decreasing rate. Many young people move into suburban areas or big cities in the developing countries.

### Comparison of Internet Usage of Developed vs. Developing Countries
```{r}
developed_internet <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedinternet) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = '% of Popupation Using Internet of Developed Countries', x = 'year', y = '% of Popupation Using Internet') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_internet <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developinginternet) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = '% of Popupation Using Internet of Developing Countries', x = 'year', y = '% of Popupation Using Internet') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_internet,developing_internet, ncol = 1, nrow = 2)
```

***
% Population Using Internet Comparison

Developed countries have average around 70% of population having access to Internt while the percentage is around 50% in most of BRICS countries except India.

Overall, Internet usage rate has been increasing since 2000. This indicates more of technology is involved in each country’s development strategy.


### Comparison of Import Value of Developed vs. Developing Countries
```{r}
developed_import <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedimport) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'Import Value Index of Developed Countries', x = 'year', y = 'Import Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_import <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingimport) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = 'Import Value Index of Developing Countries', x = 'year', y = 'Import Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_import,developing_import,ncol = 1, nrow = 2)
```

***
Import Comparison

Developing countries beat developed countries in Import Value Index, especially China and India.


### Comparison of Export Value of Developed vs. Developing Countries
```{r}
developed_export <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedexport) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'Export Value Index of Developed Countries', x = 'year', y = 'Export Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")

developing_export <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingexport) + 
    geom_bar(stat="identity", position=position_dodge()) +
    labs(title = 'Export Value Index of Developing Countries', x = 'year', y = 'Export Value Index') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_export,developing_export,ncol = 1, nrow = 2)
```
***
Export Comparison

Developing countries beat developed countries in Export Value Index, especially China and India.


### Comparison of High-tech Export of Developed vs. Developing Countries
```{r}
developed_tech <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developedtech) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'High-technology exports (% of manufactured exports) in Developed Countries', x = 'year', y = '% High-tech Export') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developed Countries")
      
developing_tech <- ggplot(aes(x=Year, y=Value, fill=Country.Name), data=developingtech) + 
    geom_bar(stat="identity", position=position_dodge())+
    labs(title = 'High-technology exports (% of manufactured exports) in of Developing Countries', x = 'year', y = '% High-tech Export') +
      theme_minimal() + 
      theme(legend.position='top') +
      labs(x = "", fill = "Developing Countries")

grid.arrange(developed_tech,developing_tech,ncol = 1, nrow = 2)
```

***
High-Technology Export Comparison

Generally, developed Countries have sigfinicant higher proportion of High-Techolology export comparing with BRICS countries. China is an exception which has comparable proportion of high-tech export as United States.