commiting changes to r code for assignment 2