Learn R Programming

rje (version 1.12.1)

subsetMatrix: Matrix of Subset Indicators

Description

Produces a matrix whose rows indicate what subsets of a set are included in which other subsets.

Usage

subsetMatrix(n)

Value

An integer matrix of dimension 2^n by 2^n.

Arguments

n

integer containing the number of elements in the set.

Author

Robin Evans

Details

This function returns a matrix, with each row and column corresponding to a subset of a hypothetical set of size n, ordered lexographically. The entry in row i, column j corresponds to whether or not the subset associated with i is a superset of that associated with j.

A 1 or -1 indicates that i is a superset of j, with the sign referring to the number of fewer elements in j. 0 indicates that i is not a superset of j.

See Also

combinations, powerSet, designMatrix.

Examples

Run this code

subsetMatrix(3)

Run the code above in your browser using DataLab