I have perused the existing posts on dcast and the official dcast vignette. I may not have framed my searches correctly, but I haven't found an example quite like mine. Take a look at my toy data on excel (which I can read into R). It's already in melted form. As you can see, the student~day columns have multiple duplicate entries because a student can wear multiple articles of clothing on the same day. I want to recast as wide without losing duplicate rows (see arnav's first two entries)--
Student | Day | Clothes |
---|---|---|
Arnav | Mon | red shirt |
Arnav | Mon | blue pants |
Beth | Mon | dress |
Chuo | Mon | dress |
Beth | Tues | green shirt |
Beth | Tues | blue pants |
Chuo | Tues | dress |
For each student on each day, I want to combine the clothes' column like this:
Student | Day | Clothes |
---|---|---|
Arnav | Mon | red shirt, blue pants |
Beth | Mon | dress |
Chuo | Mon | dress |
Beth | Tues | green shirt, blue pants |
Chuo | Tues | dress |
Thank you so much!