Coursera R Programming Assignment 4