coursera R Programming assignment 2