R code for data analytics