R Code from Andy Martin's class