updated assignment 2 R file