Finished the R script