Coursera homework for R Programming