Off topic:R merge columns in the same file with identical column names and remove duplicates
0
0
Entering edit mode
6.4 years ago
Seigfried ▴ 80

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

R • 5.8k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2711 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6