View source: R/permute_combinations_with_replacement.r
permute_combinations_with_replacement | R Documentation |
Given a vector x, permutes all possible groups of size m ignoring order and allowing any item in x to appear multiple times.
permute_combinations_with_replacement(x, m)
x |
A character vector. |
m |
A positive integer indicating the size of the set desired. |
This is a simple combinatoric function used internally in Claddis where all possible combinations of x
that are size m
are permuted. Note that this ignores order (i.e., the sets \A,B\ and \B,A\ are considered identical) and replacements (or multiples) of an element of x
are allowed (i.e., the sets \A,A\ and \B,B\ are both valid).
A matrix of m columns where each row is a unique combination of x.
Graeme T. Lloyd graemetlloyd@gmail.com
# Permute all the ways the letters A-C can form a set of size 3:
permute_combinations_with_replacement(x = LETTERS[1:3], m = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.