I have a need that I imagine could be satisfied by aggregate
or reshape
, but I can't quite figure out.
I have a list of names (brand
), and accompanying ID number (id
). This data is in long form, so names can have multiple ID's. I'd like to de-dupicate by the name (brand
) and concatenate the multiple possible id
's into a string separated by a comment.
For example:
brand id
RadioShack 2308
Rag & Bone 4466
Ragu 1830
Ragu 4518
Ralph Lauren 1638
Ralph Lauren 2719
Ralph Lauren 2720
Ralph Lauren 2721
Ralph Lauren 2722
should become:
RadioShack 2308
Rag & Bone 4466
Ragu 1830,4518
Ralph Lauren 1638,2719,2720,2721,2722
How would I accomplish this?