R code for some projects