icomb | R Documentation |
Create an iterator for all combinations k integers out of 1 through n.
icomb(n, k)
icombv(values, k)
n |
positive integer |
k |
positive integer no greater than n |
values |
iterable (subsettable by |
icomb
iterates through integer vectors
icombv
iterates through general values
iterator object
x <- icomb(5, 3)
ct <- 0
while (hasNext(x))
{
ct <- ct + 1
i <- nextElem(x)
cat(sprintf("%3d : %s\n", ct, paste0(i, collapse = " ")))
}
as.list(icombv(c("A", "G", "C"), 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.