Final version of R programming Assignment 2