Updated README.md and added error handling and additional comments to R script