Coursera R Programming Assignment 3