set: Logical flag indicating whether duplicates should be removed from the source vector v. Defaults to TRUE.
repeats.allowed: Logical flag indicating whether the constructed vectors may include duplicated values. Defaults to FALSE.
Details
Caution: The number of combinations increases rapidly with n and r!.
To use values of n above about 45, you will need to increase R's recursion limit. See the expression argument to the options command for details on how to do this.
Returns
Returns a matrix where each row contains a vector of length r.
combinations(3,2,letters[1:3])combinations(3,2,c(1:3),repeats=TRUE)combinations(6,3,1:6,repeats=TRUE)# To use large 'n', you need to change the default recusion limitoptions(expressions=1e5)cmat <- combinations(100,2)dim(cmat)# 4950 by 2