I am very new to R and sqldf and can't seem to solve a basic problem. I have a file with transactions where each row represents a product purchased.
The file looks like this:
customer_id,order_number,order_date, amount, product_name
1, 202, 21/04/2015, 58, "xlfd"
1, 275, 16//08/2015, 74, "ghb"
1, 275, 16//08/2015, 36, "fjk"
2, 987, 12/03/2015, 27, "xlgm"
3, 376, 16/05/2015, 98, "fgt"
3, 368, 30/07/2015, 46, "ade"
I need to find the maximum amount spent in a single transaction (same order_number
) by each customer_id
. For example in case of customer_id "1"
it would be (74+36)=110
.