R Programming: completed PA2