powerset: Generating power set of a set

Description Usage Arguments Details Value Note Author(s) Examples

Description

Generates the power set of a given set of values.

Usage

1
 powerset(x, fileout = NA, only.file = FALSE)

Arguments

x

a vector.

fileout

a character string which contains name of the target file.

only.file

a logical. Only a file is created, if true (default=FALSE).

Details

Suppose you have a set S. The power set is the set off all subsets of S, including empty set and S itself. The number of elements of the power set is 2^(number of elements of S). You can save the powerset in a file, if a filename fileout is specified.

Empty set will be excluded.

Value

powerset generates a list of all subsets of x, excluding empty set, if only.file=F.

Note

powerset is resctricted to vectors with maximum number of 15 elements. Using only.file=T you can create bigger powersets.

Author(s)

Sven Knueppel

Examples

1
2
ps <- powerset(1:10)
ps

HapEstXXR documentation built on May 1, 2019, 10:54 p.m.