Add R code example for paper