R/permute.R

Defines functions `permute`

`permute` <- function(i, n, control) {
    complete <- getComplete(control)
    ap <- getAllperms(control)
    perm <- if (complete && !is.null(ap)) {
        ap[i, ]                 # select ith permutation
    } else {
        if (complete) {
            warning("'$all.perms' is NULL, yet '$complete = TRUE'.\nReturning a random permutation.")
        }
        shuffle(n, control)
    }
    perm
}

Try the permute package in your browser

Any scripts or data that you put into this service are public.

permute documentation built on March 18, 2022, 7:36 p.m.