1、测试数据sname.csv
1 a 2 b 3 c 4 b 5 d 6 e 7 e 8 f 9 g 10 f
test <- read.csv("sname.csv", header = F) test dupid <- test$V2[duplicated(test$V2)] dupid <- as.data.frame(dupid) dupid dupnum <- which(duplicated(test$V2)) dupnum <- as.data.frame(dupnum) dupnum