Adding my answers to assignment 3 for R Programming Code