R/duplicated2.R

Defines functions duplicated2

Documented in duplicated2

duplicated2 <- function(x){
    if (sum(dup <- duplicated(x)) == 0) {
        return(dup)
    }
    if (class(x) %in% c("data.frame", "matrix")) {
        return(duplicated(rbind(x[dup, ], x))[-seq_len(sum(dup))])
    } else {
        return(duplicated(c(x[dup], x))[-seq_len(sum(dup))])
    }
}
mcanouil/myScriptsMickael documentation built on May 22, 2017, 1:08 a.m.