R Programming, Assignment2 result code