I am relatively new to R and don't know exactly how to phrase my question. Basically, I have a dataframe test that looks like:
PMID PL subject
1 Canada neurology
2 USA cancer
5 Canada dermatology
2 USA respiratory
4 Japan neurology
2 USA cancer
5 Canada cardiovascular
which I want to convert into
PMID PL subject
1 Canada neurology
2 USA cancer, respiratory
5 Canada dermatology, cardiovascular
4 Japan neurology
In essence, each PMID can correlate to multiple subjects, so I want to retain that information. I want only unique PMID rows. I also do want do delete repeat occurrences, however (for instance there are 3 rows of "2" but 2 of them are "cancer." Also, I have other variables too, and each PMID has the same values for each of the other variables (except for subject).
Please advise.
Thanks!