I have row-wise transaction data in the following long format
TransactionId ItemCode
101 123
101 521
102 423
103 871
103 982
103 131
I want to reshape this to get all items in one transaction in one row, so the new reshaped table looks like this (wide)
TransactionID ItemCode(s)
101 123 521
102 423
103 871 982 131
I have tried melting and casting in R, but i am a bit confused about the how the methods work. Also my dataset is huge, it has 30M rows. How should I go about this process?