Added the last step to the R script