Coursera R Class Programming Assignment 2