R script updates