View source: R/generation_powers.R
generate_combinations_with_replacement | R Documentation |
This very simple helper generates combinations with replacement.
generate_combinations_with_replacement(x, k)
x |
vector of elements to choose from. |
k |
number of elements to choose. |
This is replicating the functionality from arrangements::combinations
with
replace = TRUE
. Note that base R function utils::combn
only returns
combinations without replacement, thus pairs like (0, 0) are not in the
output.
Note that this function is extremely inefficient and only intended to be used with small use cases, i.e. small k. This is typically the case in the context of MFP, but a warning is given if this is not the case since the algorithm may take a while to compute the combinations, and even longer to do model selection.
A m x k matrix, where m is the number of combinations.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.