Solved programming assignment 2 and updated R-source accordingly.