R Programming assignment 2 code