For R Programming class - programming assignment 2