permutations(x, k), combinations(x, k),
combinations_with_replacement(x, k), subsets(x), set_partitions(n),
derangements(x), cartes(...) (Cartesian product) and
gray_code(n) return lists. nT(n, k) counts partitions of n into k
parts and stirling(n, k, kind) gives Stirling numbers.
Usage
permutations(x, k = length(x))
combinations(x, k)
combinations_with_replacement(x, k)
subsets(x, k = NULL)
set_partitions(n)
derangements(x)
cartes(...)
gray_code(n)
nT(n, k)
stirling(n, k, kind = 2, signed = FALSE)Examples
length(permutations(1:4))
#> [1] 24
stirling(5, 2)
#> 15