I have the following data set and I would like to identify the product with the highest amount per customer_ID and convert it into a new column. I also want to keep only one record per ID.
Data to generate the data set:
x <- data.frame(customer_id=c(1,1,1,2,2,2), 
      product=c("a","b","c","a","b","c"), 
      amount=c(50,125,100,75,110,150))
Actual data set looks like this:
customer_id product amount
1            a       50
1            b       125
1            c       100
2            a       75
2            b       110
2            c       150
Desired output wanted should look like this:
customer_ID  product_b product_c
1            125       0
2            0         150
 
     
    