Enumerates all possible combinations of meanings for a meaning space of the given dimensionality.

enumerate.meaningcombinations(dimensionality, uniquelabels = TRUE,
  offset = 0)

Arguments

dimensionality

either a) a vector of integers specifying the number of different possible values for every meaning dimension, or b) a list or other (potentially ragged) 2-dimensional data structure listing the possible meaning values for every dimension

uniquelabels

logical, determines whether the same integers can be reused across meaning dimensions or not. When uniquelabels = FALSE, the resulting matrix will be very reminiscent of tables listing all binary combinations of factors. Ignored when dimensionality specifies the meaning values

offset

a constant that is added to all meaning specifiers. Ignored when dimensionality specifies the meaning values

Value

A matrix that has as many columns as there are dimensions, with every row specifying one of the possible meaning combinations. The entries of the first dimension cycle slowest (see examples).

Details

The resulting matrix can be passed straight on to hammingdists and other meaning distance functions created by wrap.meaningdistfunction.

See also

Examples

enumerate.meaningcombinations(c(2, 2))
#> Var2 Var1 #> [1,] 1 3 #> [2,] 1 4 #> [3,] 2 3 #> [4,] 2 4
enumerate.meaningcombinations(c(3, 4))
#> Var2 Var1 #> [1,] 1 4 #> [2,] 1 5 #> [3,] 1 6 #> [4,] 1 7 #> [5,] 2 4 #> [6,] 2 5 #> [7,] 2 6 #> [8,] 2 7 #> [9,] 3 4 #> [10,] 3 5 #> [11,] 3 6 #> [12,] 3 7
enumerate.meaningcombinations(c(2, 2, 2, 2))
#> Var4 Var3 Var2 Var1 #> [1,] 1 3 5 7 #> [2,] 1 3 5 8 #> [3,] 1 3 6 7 #> [4,] 1 3 6 8 #> [5,] 1 4 5 7 #> [6,] 1 4 5 8 #> [7,] 1 4 6 7 #> [8,] 1 4 6 8 #> [9,] 2 3 5 7 #> [10,] 2 3 5 8 #> [11,] 2 3 6 7 #> [12,] 2 3 6 8 #> [13,] 2 4 5 7 #> [14,] 2 4 5 8 #> [15,] 2 4 6 7 #> [16,] 2 4 6 8
enumerate.meaningcombinations(8) # trivial
#> Var1 #> [1,] 1 #> [2,] 2 #> [3,] 3 #> [4,] 4 #> [5,] 5 #> [6,] 6 #> [7,] 7 #> [8,] 8
enumerate.meaningcombinations(list(shape=c("square", "circle"), color=c("red", "blue")))
#> shape color #> [1,] "square" "red" #> [2,] "square" "blue" #> [3,] "circle" "red" #> [4,] "circle" "blue"