Coursera R Programming course, assignment number 2