comboRank | R Documentation |
Generate the rank (lexicographically) of combinations/permutations. These functions are the complement to comboSample
and permuteSample
. See the examples below.
GMP support allows for exploration of combinations/permutations of vectors with many elements.
comboRank(..., v, repetition = FALSE, freqs = NULL)
permuteRank(..., v, repetition = FALSE, freqs = NULL)
... |
vectors or matrices to be ranked. |
v |
Source vector. If |
repetition |
Logical value indicating whether combinations/permutations should be with or without repetition. The default is |
freqs |
A vector of frequencies used for producing all combinations/permutations of a multiset of |
These algorithms rely on efficiently ranking the n^{th}
lexicographical combination/permutation.
A vector of class integer
, numeric
, or bigz
determined by the total number of combinations/permutations
v
must be supplied.
Joseph Wood
Lexicographical order ranking/unranking
comboSample
, permuteSample
mySamp = comboSample(30, 8, TRUE, n = 5, seed = 10, namedSample = TRUE)
myRank = comboRank(mySamp, v = 30, repetition = TRUE)
all.equal(as.integer(rownames(mySamp)), myRank)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.