Coursera's R Programming Programming Assignment 3