How to reduce too many IF conditions in R




As you can see in the above image there are too many if else conditions I have applied to get the result.Is there any shorter way of doing this.Basically what I need to do is:If a value(different columns) lies between the median and third quartile of that value,there is a certain discount,if the value is above the third quartile there is a different discount rate.

fresh_sale_val grocery_sale_val milk_sale_val  frozen_sale_val detergent_sale_val deli_sale_val
          2.675              133.7         13.38                    422.3          189.025        193.12

This is a single line of the data.So in essence two conditions have to be applied to all the 6 columns which gives 12 conditional statements.
It would be really helpful to do this in a shorter way.


try using ifelse function maybe