Got the necessary R code that now needs to be translated