Transforms a meaning matrix to 'wide' format where, instead of having a column for every meaning dimension store all possible meaning values, every possible value for any dimension is treated as its own categorical 'meaning feature' whose presence or absence is represented by a logical TRUE/FALSE value in its own meaning feature column.

binaryfeaturematrix(meanings, rownames = NULL)

Arguments

meanings

a matrix or data frame with meaning dimensions along columns and different meaning combinations along rows (such as created by enumerate.meaningcombinations).

rownames

optional character vector of the same length as the number of rows of meanings.

Value

A matrix of TRUE/FALSE values with as many rows as meanings and one column for every column-value combination in meanings.

Details

Given a matrix or data frame with meaning dimensions along columns and different combinations of meaning feature values along rows, creates a a matrix with the same number of rows but with one column for every possible value for every meaning dimension.

All meaning dimensions and values are treated categorically, i.e. as factors with no gradual notion of meaning feature similarity, neither within nor across the original meaning dimensions. Information about which feature values correspond to which meaning dimensions is essentially discarded in this representation, but could in principle be recovered through the patterns of (non)-co-occurrence of different meaning features.

In order for the resulting meaning columns to be interpretable, the column names of the result are of the structure columnname=value, based on the column names of the input meaning matrix (see Examples).

Examples

#> Var2 Var1 #> [1,] 1 3 #> [2,] 1 4 #> [3,] 2 3 #> [4,] 2 4
binaryfeaturematrix(enumerate.meaningcombinations(c(2, 2)))
#> Var2=1 Var2=2 Var1=3 Var1=4 #> [1,] TRUE FALSE TRUE FALSE #> [2,] TRUE FALSE FALSE TRUE #> [3,] FALSE TRUE TRUE FALSE #> [4,] FALSE TRUE FALSE TRUE