Stat 542 Homework 3 R Code