coursera R-programming assignment 3