Programming assignment 2 for the R course at coursera