Assignment 2 for R programming of Coursera