Learn R Programming

kst (version 0.5-0)

as.famset: Convert a binary matrix to a family of sets

Description

Create a set of sets from a binary matrix where each row of the matrix is taken as one set.

Usage

as.famset(m, as.letters = TRUE)

Arguments

m

A binary matrix.

as.letters

logical, should the elements of the sets be letters or numbers?

Value

An R object of class set containing sets..

Details

as.famset takes a binary matrix and converts it to a family (i.e. set) of sets where each row of the matrix represents one set and a "1" in row i and column j means that element j is contained in set i.

If as.letters is TRUE the elements of the sets are letters, otherwise numbers.

If the matrix contains the same row multiple times it is contained only once in the resulting family of sets.

See Also

as.binaryMatrix, set

Examples

Run this code
# NOT RUN {
m <- matrix(c(1, 0, 0, 1, 1, 0), nrow = 2, ncol = 3)
m
as.famset(m)
as.famset(m, as.letters = FALSE)
# }

Run the code above in your browser using DataLab