根据sample列的值分组,删除每一组小于2条的数据组
deleteuniquelines <- function(x) {# x为输入的数据框
stand.col <- x$sample # 设根据x的sample进行删除操作
count <- table(stand.col)
if (all(count < 2)) stop("no repeated records")
else {
ind <- sapply(stand.col, function(t) ifelse(count[as.character(t)] > 1, TRUE, FALSE))
}
return(x[ind, ])
}
a<-deleteuniquelines(maindata) #402组