make a correct R code