I have this dataframe:
restaurant = c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5)
product = c("small", "medium", "large",
"small", "medium", "large",
"small", "medium", "large",
"small", "medium", "large",
"small", "medium", "large")
unitssold = c(30,25,59,20,10,50,10,15,20,5,6,12,25,67,100)
id = c(1,5,4,3,2,1,5,6,7,4,3,9,1,5,3)
df <- data.frame(restaurant,product,unitssold,id)
And I would like to define a new column names SaleKG. To calculate this number: - if a small portion than = unitssold * 5 - if a medium portion than = unitssold * 8 - if a large portion than = unitssold *10
How can I achieve this?