my data format looks like this.
order_id Prod1 prod2 Prod3 Prod4 Prod5
A 1 0 1 1 1
B 0 0 1 1 0
C 1 1 0 1 1
I want to transform this table in a manner such that All order IDs having Products as "1" should be next to each other under a new var called Product i.e.
order_id Prod
A Prod1
A Prod3
A Prod4
A Prod5
B Prod3
B Prod4
and so on. I am trying to program it in R. Any help in this regard would be appreciated