Prog Assignment 2 for R course