update R script