Improved R script and edited README.md