modified R code file for programming assignment 2