version 1 of solution for week3 coursera R https://github.com/franzoni/ProgrammingAssignment2