R Code for Scenario