Complete R script used to do Assignment 4