如何合并具有不同信息的同一数据框中的行

时间:2019-06-10 19:21:59

标签: r dataframe merge

我有一个文件,在同一数据帧中有几行重复,但是有些行比其他行具有更多信息,像这样:

Animal  Father Mother    Birth  Weight Weight2
 1       John    NA      2017     15    NA
 1       NA    Cindy     2017     NA    NA

我需要这样的数据框,其中包含重复的信息:

Animal  Father Mother    Birth  Weight Weight2
 1       John   Cindy      2017     15    NA

我尝试了这段代码New.file=aggregate(Animal, data=my.file, FUN=max),但是没有用。

0 个答案:

没有答案
相关问题