R Code to Accompany Solutions to Homework 9