homework for learning R prg-assignment2