This is the edited R file for Homework Assignment 2