Problem Set II in R