This is my programming assignment 2 on Coursera course R Programming