R code for practice set