Learn R Programming

dst (version 1.8.0)

productSpace: Product space representation of a relation

Description

This utility function takes the input matrix of a relation between two or more variables and yields its product space representation.

Usage

productSpace(tt, specnb, infovar)

Value

The matrix of the product space representation of the relation.

Arguments

tt

A (0,1) or boolean matrix, where the variables are set side by side, as in a truth table. Each variable has a number of columns equal to the number of possible values.

specnb

A vector of integers ranging from 1 to k, where k is the number of subsets of the tt matrix. Values must start at one and can be increased by 1 or not. They determine the partitioning of the rows of the tt matrix between the k subsets.

infovar

A two-column matrix containing identification numbers of the variables and the number of elements of each variable (size of the frame).

Author

Claude Boivin

Examples

Run this code
 ttfw <- matrix(c(1,0,1,0,0,1,0,1,1,1,1,1),nrow = 3,
  byrow = TRUE, 
  dimnames = list(NULL, c("foul", "fair", "foul", "fair")) )
 specfw <- c(1,1,2) 
 infovarfw <- matrix(c(5,7,2,2), ncol = 2, 
 dimnames = list(NULL, c("varnb", "size")) )
 rownames(ttfw) <- nameRows(ttfw)
 ttfw
productSpace(tt = ttfw, specnb = specfw, infovar = infovarfw)

Run the code above in your browser using DataLab