update the R code