Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

powerset

Power set


Description

Finds the list of all subsets of a set.

Usage

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

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.

Details

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

Value

A list of all subsets of set.

Author(s)

Giovanni M. Marchetti

Examples

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

ggm

Graphical Markov Models with Mixed Graphs

v2.5
GPL-2
Authors
Giovanni M. Marchetti, Mathias Drton, Kayvan Sadeghi
Initial release
2020-02-014

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.