Skip to content
Prev 154782 / 398506 Next

give all combinations

CW> I seem to be missing something here:
    CW> given a set X:{a,b,c,whatever...}
    CW> the mathematical definition of 'permutation' is the set of all possible 
    CW> sequences of the elements of X.
    CW> The definition of 'combination' is all elements of 'permutation' which 
    CW> cannot be re-ordered to become a different element.

    CW> example:  X:{a,b,c}

    CW> perm(X) = ab, ab, bc, ba, ca, cb
    CW> comb(X) = ab, ac, bc


    CW> So maybe a better question for this mailing list is:  Are there 
    CW> functions available in any R package which produce perm() and comb() 
    CW> (perhaps as well as other standard combinatoric functions) ?

combn()  has been "standard R"  for quite a while now.

As others have mentioned in this thread (different branch of
same thread-tree), for permutations, one can typically easily
get what one wants  via  expand.grid() or  outer()  [or
mapply() .. ].
For that reason, those knowing R well haven't seen a big need
for a permutation() function.

Martin Maechler, ETH Zurich and R Core Team