changing R code