update codes in R script