Programming Assignment 3 for Coursera R Programming course