Assignment 2 in R Programming