R code assignment 2