Assignment 2 for Coursera course R Programming