R/perm.R

# aus gtools
perm <- function(n, r, v=1:n) {
    if (r == 1)
        matrix(v, n, 1)
    else if (n == 1)
        matrix(v, 1, r)
    else {
        X <- NULL
        for (i in 1:n) X <- rbind(X, cbind(v[i], Recall(n -
            1, r - 1, v[-i])))
        X
    }
}

Try the prefmod package in your browser

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

prefmod documentation built on May 2, 2019, 4:59 p.m.