added R code from first 3 lectures of week 2