This is project1 full R code

This mark-up for any doubts in the individual codes