Completed assignment

Commiting the R file with the completed assignment