Implemented R Programming assignment 2.