EDITS TO FINALIZE CODE AFTER TESTING

various edits made to finalize the code after thorough testing with an example dataset.
R PACKAGE DOCUMENTATION ADDED