subsets: Compute Subsets

Description Usage Arguments Details Value See Also Examples

View source: R/subsets.r

Description

Compute the subsets of a given set.

Usage

1
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?

Details

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

Value

a list of subsets as vectors

See Also

combn

Examples

1
2
3
4
5
6
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)

algstat documentation built on May 29, 2017, 10:34 p.m.

Related to subsets in algstat...