Second programming assignment for R Programming in Coursera