I need to transpose repeated columns in rows. Indeed, I have one line by client and in this line there is as much columns as number of sales. I want to transpose the sales informations to have one row for each sales for one client.
If a client has only one sales, I want only one line. If it's not possible it doesn't matter, I will deal with it in an other step with sql in R.
To illustrate I have something like that :
Id/name/idSale1 / saleAmount1 /idSale2 / saleAmount2
42/james/698 /30 /1002 / 100
102/cathy/574 /120 /708 / 40
14/david /450 /70 / NA / NA
And I want something like that
Id/name / idSale / saleAmount /
42/james /698 /30
42/james /1002 / 100
102/cathy /574 /120
102/cathy /708 / 40
14/david /450 /70
Thank you for your time