packages<-c("ggplot2","readr","tidyverse","dplyr","ggpubr")

check_install_packages<-function(pkg){
  if (!require(pkg, character.only = TRUE)){
    install.packages(pkg,dependencies = TRUE)
    library(pkg,character.only = TRUE)
  }
}

sapply(packages,check_install_packages)
## $ggplot2
## NULL
## 
## $readr
## NULL
## 
## $tidyverse
## NULL
## 
## $dplyr
## NULL
## 
## $ggpubr
## NULL
data("USArrests")
head(USArrests)
##            Murder Assault UrbanPop Rape
## Alabama      13.2     236       58 21.2
## Alaska       10.0     263       48 44.5
## Arizona       8.1     294       80 31.0
## Arkansas      8.8     190       50 19.5
## California    9.0     276       91 40.6
## Colorado      7.9     204       78 38.7
?USArrests
#The USArrests data looks at four different statistics related to arrests in six states. The different variables that can be used are Murder, Assault, UrbanPop, and Rape. Assault, Murder, and Rape are in number of arrest per 100,000 residents. UrbanPop is the percentage of the population living in urban areas. All variables are numerical.
## GGplot Graphic Code

ggplot(mtcars, aes(x=mpg, y=hp, color=cyl))+
  geom_point(size=2.4, shape=8)+
  ggtitle("Effect of Horsepower on Fuel Efficiency", subtitle="Categorized by Number of Cylinders")+
  ylab("Fuel Efficiency (MPG)")+
  xlab("Horsepower")+
  theme_minimal()+
  theme(
    legend.position = "bottom",
    legend.box = "horizontal",
    plot.margin = margin(t = 10, r = 10, b = 10, l = 10)
  )

## Playing around
data("ChickWeight")
head(ChickWeight)
##   weight Time Chick Diet
## 1     42    0     1    1
## 2     51    2     1    1
## 3     59    4     1    1
## 4     64    6     1    1
## 5     76    8     1    1
## 6     93   10     1    1
?ChickWeight

ggplot(ChickWeight, aes(x=weight, y=Time, color=Diet))+
  geom_point(shape=16, size=2)+
  scale_color_manual(values = c("#56B4E9", "#CC79A7", "#E69F00","#009E73"))+
  ggtitle("Effect of Time on Fuel Chick Weight", subtitle="Categorized by Diet")+
  ylab("Chick Weight (gm)")+
  xlab("Time (days since hatch)")+
  theme_minimal()+
  theme(
    legend.position = "bottom",
    legend.box = "horizontal",
    plot.margin = margin(t = 10, r = 10, b = 10, l = 10)
  )