Small modifications to R script.