Learn R Programming

cquad (version 2.3)

sq: Generate binary sequences

Description

Generate binary sequences of a certain length and with a certain sum.

Usage

sq(J, s = NULL)

Value

M

Matrix of binary configurations

Arguments

J

length of the binary sequences

s

sum of the binary sequences (optional)

Author

Francesco Bartolucci (University of Perugia)

Examples

Run this code
# generage all sequence of 5 binary variables
sq(5)
# generage all sequence of 5 binary variables, with sum equal 2
sq(5,2)

Run the code above in your browser using DataLab