0

I have the following data frame:

gene    gene_name   source  chromosome  details
1       a           A           2       01; xyz
1       a           A           2       02; ijk
2       b           B           3       03; efg
2       b           C           3       03; efg
3       c           D           4       04; lmn
3       c           D           4       05; opq
3       c           D           4       06; rst
4       NA          10          6       NA
4       NA          11          6       NA

I want to get the following output:

gene    gene_name   source  chromosome  details
1       a           A       2           01; xyz | 02;ijk
2       b           B, C    3           03; efg
3       c           D       4           04; lmn | 05; opq | 06; rst
4       NA          10, 11  6           NA | NA

I have tried to use aggregate() and group_by() in different ways, but did not get it.

Please guide.

Thanks.

Sotos
  • 51,121
  • 6
  • 32
  • 66
bio8
  • 176
  • 2
  • 15
  • @https://stackoverflow.com/users/5635580/sotos The posts you mentioned are not helpful. :-( – bio8 Nov 20 '19 at 15:11
  • As per "Your post has been associated with similar questions. If these questions don’t resolve your question, ask a new one." I am going to re-post. – bio8 Nov 20 '19 at 15:34
  • Link to new post: https://stackoverflow.com/questions/58958102/r-how-to-combine-duplicated-rows-from-multiple-columns-based-on-unique-values-i – bio8 Nov 21 '19 at 09:40

0 Answers0