Skip to contents

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

Usage

bincombinations(p)

Arguments

p

Length of binary vectors

Author

Friedrich Leisch

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