added R code for lesson 3