R code created for Coursera Data Science course