Merging data frames


How to merge two tables when there are duplicated values in the first table?


Hi @sambid9988,

It depends on what is the final table that you wish to form and the tool you wish to use.

Considering, If you are using R, you can use unique() to select unique values from first table and then use merge() to merge the two tables by using by= ’ the column based on which you want to merge them’.

Hope this helps. If not, Let me know more details about the datasets so that I can elaborate further.


you can use library(dplyr)
dataframe_name %>% distinct # to find the distinct values in the dataframe

later you can merge by using left join or join of dplyr

Train <- left_join(df1, df2, by = column name))


thankyou… i thought it won’t merge properly.