sq {LCCR}R Documentation

Build matrix of binary vectors of a fixed lenght

Description

It creates all possible binary (with elements equal to 0 or 1) vectors of a specified length; these vectors are casted in a matrix having a number of columns equal to the vector length. If required, the binary vectors are constrained to have the same total (sum of their elements).

Usage

sq(J, t = NULL)

Arguments

J

legnth of binary vectors

t

possible fixed total

Value

M

matrix containing all binary vectors

Author(s)

Francesco Bartolucci, Antonio Forcina

Examples

# build matrix of all possible binary vectors of legnth 5
  M = sq(5)
  
# build matrix of all possible binary vectors of legnth 5 with total equal 2
  M = sq(5,2)

[Package LCCR version 1.3 Index]