R code snippets