algstat (version 0.0.2)

subsets: Compute Subsets

Description

Compute the subsets of a given set.

Usage

subsets(set, sizes = 1:length(set), include_null = FALSE)

Arguments

set
the original set
sizes
desired size(s) of subsets
include_null
should the empty vector be included?

Value

a list of subsets as vectors

Details

Note that this algorithm is run in R: it is therefore not intended to be the most efficient algorithm for computins subsets.

See Also

combn

Examples

Run this code
subsets(1:3)
subsets(1:3, size = 2)
subsets(1:3, include_null = TRUE)

subsets(c('a','b','c','d'))
subsets(c('a','b','c','d'), include_null = TRUE)

Run the code above in your browser using DataLab