Coursera R Programming Course Assignment 3