R code completed