Added R code and graphics