#データフレーム内のデータの重複を探し出す関数 check.dup <- function(df){ res <- setdiff(rownames(df), rownames(unique(df))) df[res,] } # 使用方法 test <- as.data.frame(matrix(c("a","a","b","b","c","c","1","2","2","2","2","3"), ncol=2)) check.dup(test)