R Programming Assignment 2 from https://class.coursera.org/rprog-002/human_grading/view/courses/972078/assessments/3/submissions