This is the second programming assignment on coursera R-programming.