Learn R Programming

ggm (version 2.5.1)

powerset: Power set

Description

Finds the list of all subsets of a set.

Usage

powerset(set, sort = TRUE, nonempty = TRUE)

Value

A list of all subsets of set.

Arguments

set

A numeric or character vector.

sort

Logical value. If TRUE the subsets are sorted according to dimension. Default is TRUE.

nonempty

Logical value. If TRUE the empty set is omitted. Default is TRUE.

Author

Giovanni M. Marchetti

Details

If sort == FALSE the sets are in inverse lexicographical order.

Examples

Run this code
powerset(c("A", "B", "C"), nonempty = FALSE)  
powerset(1:3, sort = FALSE, nonempty = TRUE)

Run the code above in your browser using DataLab