Assignment 2 for the Coursera R programming course