R Programming Assignment2 Final Changes2(unnecessary code removed)