sq: Build matrix of binary vectors of a fixed lenght

Description Usage Arguments Value Author(s) Examples

View source: R/sq.R

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

1
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

1
2
3
4
5
# 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)

LCCR documentation built on Dec. 11, 2021, 9:30 a.m.