combnk | R Documentation |
A fast function to generate all possible combinations of n numbers, taken k at a time, starting from the first k numbers or starting from a combination that contain a certain number.
combnk(n, k, ogte = 0, zerobased = FALSE)
n |
Vector of any kind, or a numerical scalar. |
k |
Numeric scalar. |
ogte |
At least one value greater than or equal to this number. |
zerobased |
Logical, zero or one based. |
When a scalar, argument n
should be numeric, otherwise when a vector its
length should not be less than k
.
When the argument ogte
is specified, the combinations will sequentially
be incremented from those which contain a certain number, or a certain position from
n
when specified as a vector.
A matrix with k
rows and choose(n, k)
columns.
Adrian Dusa
combnk(5, 2)
combnk(5, 2, ogte = 3)
combnk(letters[1:5], 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.