Assignment 2 for the coursera R programming course