powered by
Create an iterator for all permutations of size k of integers 1 to n.
iperm(n, k = n)ipermv(values, k = length(values))
ipermv(values, k = length(values))
positive integer
iterable (subsettable by [)
[
iterator object
iperm iterates through integer vectors
iperm
ipermv iterates through general values
ipermv
# NOT RUN { x <- iperm(3) ct <- 0 while (hasNext(x)) { ct <- ct + 1 i <- nextElem(x) cat(sprintf("%3d : %s\n", ct, paste0(i, collapse = " "))) } as.list(ipermv(c("R", "G", "B"))) # }
Run the code above in your browser using DataLab