I wrote some R code...