[R] (no subject)

Salas, Andria Kay aks2515 at uncw.edu
Mon Nov 17 16:54:29 CET 2008

I need help generating all possible combination of a vector of randomly assigned values of 1 and -1.  For example, a vector of 20 randomly placed 1s and -1s, and all possibilities (which would amount to 2^20 total vectors).  I am able to generate one such vector (via sample(c(-1,1),20,replace=TRUE)), but I do not know how to generate all the possibilities, which would need to be placed in a matrix.  Any help would be greatly appreciated!!! 

More information about the R-help mailing list