Skip to content

Choices from a matrix

1 message · Bert Gunter

#
Quite right (ALWAYS TEST, Bert!), because expand.grid() returns a
data.frame. But all you have to do is create newX as a data.frame:

newX<-data.frame(matrix(0, ncol=ncol(X),nrow=2^length(I)))

and **now** it will work:
X1 X2 X3
1  1  0  5
2  2  0  5
3  1  0  6
4  2  0  6

Note that newX is a data.frame -- you may wish to recast it as a matrix. Of
course, I'm still not sure that this is what you wanted.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box