Implementation of Coursera R Course Programming Assignemnt 2