Returns a matrix containing the \(2^p\) vectors of length p.

bincombinations(p)

Arguments

p

Length of binary vectors

Examples

bincombinations(2)
#> [,1] [,2] #> [1,] 0 0 #> [2,] 0 1 #> [3,] 1 0 #> [4,] 1 1
bincombinations(3)
#> [,1] [,2] [,3] #> [1,] 0 0 0 #> [2,] 0 0 1 #> [3,] 0 1 0 #> [4,] 0 1 1 #> [5,] 1 0 0 #> [6,] 1 0 1 #> [7,] 1 1 0 #> [8,] 1 1 1