1 Economist Plot

Here, I want to re-create economist plot about correlation between corruption and development in many country using dataset that you can get in thos link.



Graph source : (http://www.economist.com/node/21541178)

1.1 Package Used

## $pdftools
## [1] "pdftools"  "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [7] "methods"   "base"     
## 
## $tidyverse
##  [1] "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
##  [6] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "pdftools" 
## [11] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [16] "methods"   "base"     
## 
## $ggplot2
##  [1] "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
##  [6] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "pdftools" 
## [11] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [16] "methods"   "base"     
## 
## $ggthemes
##  [1] "ggthemes"  "forcats"   "stringr"   "dplyr"     "purrr"    
##  [6] "readr"     "tidyr"     "tibble"    "ggplot2"   "tidyverse"
## [11] "pdftools"  "stats"     "graphics"  "grDevices" "utils"    
## [16] "datasets"  "methods"   "base"     
## 
## $ggrepel
##  [1] "ggrepel"   "ggthemes"  "forcats"   "stringr"   "dplyr"    
##  [6] "purrr"     "readr"     "tidyr"     "tibble"    "ggplot2"  
## [11] "tidyverse" "pdftools"  "stats"     "graphics"  "grDevices"
## [16] "utils"     "datasets"  "methods"   "base"     
## 
## $tm
##  [1] "tm"        "NLP"       "ggrepel"   "ggthemes"  "forcats"  
##  [6] "stringr"   "dplyr"     "purrr"     "readr"     "tidyr"    
## [11] "tibble"    "ggplot2"   "tidyverse" "pdftools"  "stats"    
## [16] "graphics"  "grDevices" "utils"     "datasets"  "methods"  
## [21] "base"     
## 
## $grid
##  [1] "grid"      "tm"        "NLP"       "ggrepel"   "ggthemes" 
##  [6] "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
## [11] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "pdftools" 
## [16] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [21] "methods"   "base"     
## 
## $dplyr
##  [1] "grid"      "tm"        "NLP"       "ggrepel"   "ggthemes" 
##  [6] "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
## [11] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "pdftools" 
## [16] "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [21] "methods"   "base"

2 Data Pre-Processing

This data is about Human Development Index (HDI) and Corruption Perception Index (CPI) in many country in the world. We want to look relation between HDI and CPI in many country.

##       Country HDI.Rank   HDI CPI            Region
## 1 Afghanistan      172 0.398 1.5      Asia Pacific
## 2     Albania       70 0.739 3.1 East EU Cemt Asia
## 3     Algeria       96 0.698 2.9              MENA
## 4      Angola      148 0.486 2.0               SSA
## 5   Argentina       45 0.797 3.0          Americas
## 6     Armenia       86 0.716 2.6 East EU Cemt Asia
##  Country HDI.Rank      HDI      CPI   Region 
##        0        0        0        0        0

Before making economist, we start to manipulate the data.

3 Making Economist

We want to visualise the data using ggplot2.

After we plot our point of data by HDI and CPI variable, we want to make a linear line based on HDI and CPI.

After we make a linear line, we want to look our country position in the plot point.

It looks not good and so crowded and not pretty. So let’s let’s set the country point that we will display in the plot.

## png 
##   2