0

I have a dataframe of the following format:

ShipId Customer1 Customer2 Weight1 Weight2 Value
1 A B 12 13 40
2 B C 13 14 60

I wish to reshape it to the following format:

ShipId Customer Weight Value
1 A 12 40
1 B 13 40
2 B 13 40
2 B 14 40

I tried using melt() from reshape2 package and stack(). I wasn't able to bring it to the required format.

Thanks in Advance

0 Answers0