Solution of R Programming - Assignment 2