Homework for coursera r course