R Programming assignment 2

Still needs comments checking before submission
Example code for R programming assignment 2