Addition of comments in the R file

I have added some comments within the functions.