Solutions for Programming Assignment 2

The R file has been edited to put the solution into it.