R code for thesis