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

View source: R/as.famset.R

as.famsetR Documentation

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?

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. However, if the matrix has colnames, these are taken as names for the elements of the sets taking precedence over the as.letters parameter.

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

Value

An R object of class set containing sets..

See Also

as.binaryMatrix, set

Examples

m <- matrix(c(1, 0, 0, 1, 1, 0), nrow = 2, ncol = 3)
m
as.famset(m)
as.famset(m, as.letters = FALSE)

kst documentation built on Oct. 24, 2022, 5:07 p.m.

Related to as.famset in kst...