R merge columns in the same file with identical column names and remove duplicates
Dear all
I have a dataframe containing columns with identical names for some reason. I wish to combine these columns with the same name with removing the duplicates
I tried using merge but I do not want to enter the column names one by one like merge (x, y)
horse sheep horse
A A A
B B
C
This should give
horse sheep
A A
B
C
Is there any way to do this? I googled and found ways to do it 1 by 1 but I have a lot of columns
• 6,042 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello Seigfried!
We believe that this post does not fit the main topic of this site.
Not bioinformatics. Please search SO
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
Thank you for the reply
In my case my terms were basically GO terms which I wanted to reduce (1->3)-beta-D-glucan metabolic process (1->3)-beta-D-glucan metabolic process acetyl-CoA metabolic process fksA fksA AN3817 rhoA rhoA AN3869 sunA sunA AN4923 gelA facA
It was not apparent in the original post. Please edit it and add in relevant information and I'll reopen the question.