我在R中使用duplicated()函数来查找3列中具有重复条目的样本
df <- data.frame(ID = c("1","2","3"), Lastname = c("Brown", "Wright", "Brown"), Firstname = c("Bob", "Jo", "Bob"), DOB = c("10/10/1970", "08/08/1980","10/10/1970"))
我希望获得Lastname,Firstname和DOB匹配或重复的条目
test <- df[duplicated(df[c('Lastname', 'Firstname', 'DOB')]),]
我只返回一个副本而不是两个副本
ID Lastname Firstname DOB
3 Brown Bob 10/10/70
我想返回所有重复的条目我希望
ID Lastname Firstname DOB
1 Brown Bob 10/10/70
3 Brown Bob 10/10/70