Solution for programming assignment 2 for Coursera course R Programming.