Merge data.frames with duplicates

前端 未结 3 1427
囚心锁ツ
囚心锁ツ 2020-12-11 20:29

I have many data.frames, for example:

df1 = data.frame(names=c(\'a\',\'b\',\'c\',\'c\',\'d\'),data1=c(1,2,3,4,5))
df2 = data.frame(names=c(\'a\',\'e\',\'e\',         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 21:23

    I think there is just not enough information in your example data frames to do this. Which 'c' in dataframe 1 should be paired with which 'c' in data frame 2? We cannot tell, so R can't either. I suspect you will have to add another variable to each of your dataframes that uniquely identifies these duplicate cases.

提交回复
热议问题