r programming assigment 2 - final version