Assignment 2 of coursera R programming