R programming class: Prog Assignment 2