Modify R script