Assignment 3 in coursera course R Programming