R script updated