Course Project, R code and plot