R Programming Coursera Homework