library(readxl)
library(tidyverse)
## -- Attaching packages --------
## v ggplot2 3.1.1       v purrr   0.3.2  
## v tibble  2.1.1       v dplyr   0.8.0.1
## v tidyr   0.8.3       v stringr 1.4.0  
## v readr   1.3.1       v forcats 0.4.0
## -- Conflicts -----------------
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggrepel)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
setwd("C:/Users/Windows 10/Documents")
df <- read_excel("Education.xlsx")
h1 <- ggplot(df,aes(x=G,y=E,col=ID,size=E))+geom_point(alpha=0.2, show.legend = FALSE)+scale_size(rang=c(0,20))+facet_wrap(~year)
h2 <- h1+scale_y_continuous(limits = c(0, 100),breaks = seq(15, 100, by = 20))+geom_text_repel(size=3,aes(label=ID),colour="red",force=35)+geom_text_repel(size=3,aes(label=E),data=filter(df,E>50),colour="black",force=5)
h3 <- h2+labs(x="GDP per capita ($)",y= "School enrollment, tertiary (% gross)",title="School enrollment, tertiary and GDP",caption = "DuyNguyen")
h3
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 11 rows containing missing values (geom_text_repel).