adding the R code