Early R code to move the problem to R