Editing my own R Code for ProgrammingAssignment2