Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Creating data frames
21. Counteroffer savings


Great! Let's create a new column!


Create a new column lower_by that will contain the amount a client saved regarding the original offer. Consider only the offers that were accepted. Otherwise a value should be 0.

Stuck? Here's a hint!

First, you should create the lower_by column and set it to 0. Then you need to change the values for rows that meet the condition (i.e. that were accepted):

counteroffers[counteroffers$accepted == "Y",] <- ... 

Then you should subtract the offer column from the orig_offer column. Again, you should take into considerations only the offer column and the orig_offer column for the rows where the offer was accepted:

counteroffers[counteroffers$accepted == "Y",] <- counteroffers[counteroffers$accepted == "Y",]$orig_offer - ...