Initial R code write-up