Useful examples of R code