Submission for coursera R programming course Programming Assignment 2