Coursera - R programming course - Programming assignment 2