subsets: Compute Subsets

View source: R/subsets.r

subsetsR Documentation

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?

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

utils::combn()

Examples



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)








dkahle/algstat documentation built on May 23, 2023, 12:29 a.m.