assignment 2 for the Coursera R programming