R/perm.R

Defines functions perm

# 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 Sept. 30, 2023, 5:06 p.m.