adding .R code for assignment -2...