iperm | R Documentation |
Create an iterator for all permutations of size k of integers 1 to n.
iperm(n, k = n)
ipermv(values, k = length(values))
n |
positive integer |
k |
positive integer |
values |
iterable (subsettable by |
iperm
iterates through integer vectors
ipermv
iterates through general values
iterator object
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")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.