0

I have a data frame that looks like:

name  Abundance1   Abundance2     
A     10           13 
B     10           13 
C     12           14
D     5            4 
E     5            4 

And I want to use dplyr to return a data frame that looks like:

name  Abundance1   Abundance2     
A,B     10           13 
C       12           14
D,E     5            4 

I am new to R and want to learn clean my data in dplyr, any suggestions would be greatly appreciated!

jj3973
  • 1
  • 3
    There's lots of questions about this you can follow, such as in this post: [Consolidate duplicate rows](https://stackoverflow.com/questions/10180132/consolidate-duplicate-rows). Rather than using `sum()`, in your case try and replicate those solutions by aggregating or grouping on your numeric columns and use `paste()` with `collapse = ","` to combine your `name` column. – caldwellst Mar 05 '22 at 09:00

0 Answers0