My solution to R Progamming Assignment 2 - version2