powered by
Create an iterator for all combinations k integers out of 1 through n.
icomb(n, k)icombv(values, k)
icombv(values, k)
positive integer
positive integer no greater than n
iterable (subsettable by [)
[
iterator object
icomb iterates through integer vectors
icomb
icombv iterates through general values
icombv
# NOT RUN { 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)) # }
Run the code above in your browser using DataLab