DescTools (version 0.99.11)

GetAllSubsets: Get All Subsets out of a List of Elements

Description

Returns a list with all the subsets that can be built based on the elements given in x. The number of elements used in the combinations can be limited by setting min.n and max.n.

Usage

GetAllSubsets(x, min.n = 1, max.n = length(x))

Arguments

x
a vector with elements
min.n
the minimum count of elements to be drawn. This defaults to 1.
max.n
the maximum count of elements to be drawn. Default is "all elements in x".

Value

  • a list with the subsets.

See Also

GetPairs, PairApply

Examples

Run this code
x <- LETTERS[1:6]

GetAllSubsets(x)

#get all sets of size 2 and 3
GetAllSubsets(x, min.n = 2, max.n = 3)

Run the code above in your browser using DataCamp Workspace