R/allSeries.R

Defines functions `allSeries`

`allSeries` <- function(n, nperms, mirror = FALSE)
{
    v <- seq_len(n)
    X <- matrix(nrow = nperms, ncol = n)
    for(i in v) {
        X[i,] <- seq(i, length = n)%%n + 1
    }
    ## if mirroring, rev the cols of X[v,]
    ## but only if nperms > 2
    if(mirror && (nperms > 2))
        X[(n+1):(2*n),] <- X[v, rev(v)]
    X
}

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.