I have to combine two dataframes having 90 columns. Both dataframes have some same rows. I want to have same rows should appear only once with other rows. Help Please.
Asked
Active
Viewed 506 times
0
-
Are the column names identical for the two data frames? – Peer Christensen Sep 15 '19 at 16:03
-
1If the number of the columns are equal for both of them, `df<- rbind(df1,df2)` then `df[!duplicated(df), ]` or `unique(df)` – maydin Sep 15 '19 at 16:09
-
@PeerChristensen column names are identical for two data frames. – muhammad ali baig Sep 15 '19 at 16:29
-
@maydin it is not working, few rows appears once but most of the rows appears twice. – muhammad ali baig Sep 15 '19 at 16:34
-
1@muhammadalibaig, you should create a unique ID for each row in such a way that the same row in both dataframe has the same ID and then merge the two dataframes according to the ID column. Moreover, could you also provide a [reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of your problem? – agila Sep 15 '19 at 17:51
-
@muhammadalibaig Is it not working? Sure about that? You are dealing with 90 columns and it makes so hard to understand the difference between them by eye searching. Maybe a single comma, dot or maybe a single space in one of the columns make them be different. You'd better to provide some sample data. Then it becomes easier to understand the real issue. `dput()`may be a good start which is explained in [here](https://stackoverflow.com/questions/49994249/example-of-using-dput). – maydin Sep 15 '19 at 19:24