2017 - CPI. Transparency.org. (2020). Retrieved 2 November 2020, from https://www.transparency.org/en/cpi/2017.
Human Development Data (1990-2018) | Human Development Reports. Hdr.undp.org. (2020). Retrieved 2 November 2020, from http://hdr.undp.org/en/data.
World Development Indicators (WDI) | Data Catalog. Datacatalog.worldbank.org. (2020). Retrieved 2 November 2020, from https://datacatalog.worldbank.org/dataset/world-development-indicators.
---
title: "Corruption Perception Index 2017 : Corruption Perception Index trend worldwide and it's representation with various factors "
output:
flexdashboard::flex_dashboard:
orientation: rows
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(maps)
library(tidyverse)
library(ggiraph)
library(widgetframe)
library(ggthemes)
library(plotly)
library(viridis)
library(DT)
library(scales)
library(plotly)
setwd("C:/Study material/Data Visualisation/Assignment 3")
Plot1<-read.csv("Corruption_Spatial.csv")
All_data<-read.csv("All_vs.csv")
Fig2_data<-read.csv("Topclean.csv")
Fig3_data<-read.csv("Topcorrupt.csv")
```
Dashboard
=======================================================================
Row
-----------------------------------------------------------------------
### Global Corruption Perception Index with World Ranking. Scores are on a scale of 0-100, where 0 means that a country is recognized as highly corrupt.
```{r}
fig1 <- plot_ly(Plot1, locations = ~Code, z = ~CPI,
type='choropleth', color = ~CPI, colors = 'Purples',
text = ~paste("Country:", `Entity`,
'
CPI Rank:', `RANK`,
'
Corruption Perception Index:', `CPI`))
fig1 <- fig1 %>% colorbar(title = 'CPI Scale', x =-0.2, y =1)
fig1 <- fig1 %>% layout(title = 'Corruption Perception Index 2017',
height = 350, margin = list(t = 50),
geo = list(showframe = FALSE, showcoastlines = FALSE))
fig1
```
### Representation of various indicators with Corruption Perception Index
```{r}
fig2 <- plot_ly(All_data) %>%
add_markers(x = ~`HDI`,y = ~CPI,name = "HDI vs. CPI", text =
~paste("Country:", `Entity`, '
CPI Rank:', `RANK`)) %>%
add_markers(x =~`Average_years_of_schooling`,y = ~CPI , name = "Avg yrs of schooling vs. CPI", text =
~paste("Country:", `Entity`, '
CPI rank:', `RANK`), visible =FALSE) %>%
add_markers(x = ~`GDP`, name ="GDP per capita vs CPI",y = ~CPI, text =
~paste("Country:", `Entity`,'
CPI Rank:', `RANK`), visible = FALSE) %>%
layout(
title = "Corruption Perception Index vs. Various Indicators",
xaxis = list( title ="Human Development Index", range=c(0.3,1)),
yaxis = list(title = "Corruption Perception Index"),
showlegend = FALSE,
updatemenus = list(
list(
y = 1, x = -0.1,
buttons = list(
list(method = "update",
args = list(list(visible = list(T, F, F)),
list(xaxis = list(title = "Human Development Index", range=c(0.3,1)))),
label = "HDI" ),
list(method = "update",
args = list(list(visible = list(F, T, F)),
list(xaxis = list(title = "Average years of schooling"))),
label = "Schooling"),
list(method = "update",
args = list(list(visible = list(F, F, T)),
list(xaxis = list(title = "GDP per capita", range=c(0,50000)))),
label = "GDP")
))
)
)
fig2
```
Row
-----------------------------------------------------------------------
### Countries who are top CPI scorers are all Developed Nations
```{r}
Dev<- plot_ly(Fig2_data) %>%
add_lines(x = ~Year, y = ~CPI, group = ~Entity,
color = ~Entity) %>%
layout( title = "CPI trend of 10 most Clean countries",
yaxis = list(zeroline = FALSE, title = "CPI", range = c(78, 95)),
xaxis = list(zeroline = FALSE, title = "Year"))
Dev
```
### Countries who are least scorers are all Developing or Underdeveloped Nations
```{r}
Undev<- plot_ly(Fig3_data) %>%
add_lines(x = ~Year, y = ~CPI, group = ~Entity,
color = ~Entity) %>%
layout( title = "CPI trend of 10 most Corrupt countries",
yaxis = list(zeroline = FALSE, title = "CPI", range = c(0, 30)),
xaxis = list(zeroline = FALSE, title = "Year"))
Undev
```
References
=======================================================================
Row
-----------------------------------------------------------------------
### References
* 2017 - CPI. Transparency.org. (2020). Retrieved 2 November 2020, from https://www.transparency.org/en/cpi/2017.
* Human Development Data (1990-2018) | Human Development Reports. Hdr.undp.org. (2020). Retrieved 2 November 2020, from http://hdr.undp.org/en/data.
* World Development Indicators (WDI) | Data Catalog. Datacatalog.worldbank.org. (2020). Retrieved 2 November 2020, from https://datacatalog.worldbank.org/dataset/world-development-indicators.