# installed.packages()
# install.packages('tidyverse')
library(tidyverse)
hid <- read.csv("data/hdi-cpi.csv")
head(hid)
hid<- as.tibble(hid)
head(hid)
hid
"DATA"
sc <- ggplot(hid)
sc
"ASTHETICS"
sc <- ggplot(hid, aes(CPI.2015, HDI.2015 ))
sc
"GEOMETRY"
sc + geom_point()
"FACETS"
"regions could provide a way or organizing by FACETS (series or subplots)"
sc + geom_point(aes(color = Region), size = 3) + facet_grid(Region ~. )
"STATS"
sc + geom_point(aes(color = Region), size = 3) + facet_grid(Region ~. ) + stat_smooth()
"If I only wanted to see countries in the upper quartile of the CPI index, I would define the coordinates as follows"
"COORDINATES"
sc + geom_point(aes(color = Region), size = 3) + facet_grid(Region ~. ) + stat_smooth()
+ coord_cartesian(xlim = c(0.75, 1))
"THEMES!! ggthemes package has additional themes"
sc + geom_point(aes(color = Region), size = 3) + stat_smooth()
+ theme_minimal()