Finish R code