script extracted form Rmd file. README.md updated.