Assignment 2

The completed R code for the assignment with comments