Programming Assignment 3 code. (Programming R)