[R] expand.grid overflows?

francogrex francogrex at mail.com
Fri Nov 16 12:35:17 CET 2007


>cbn<-as.matrix(expand.grid( rep( list(0:1), 50))) 

Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : 
  invalid 'times' value
In addition: Warning message:
In rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :
  NAs introduced by coercion

But I'm only interested in cbn matrix rows where:
cbn<- cbn[rowSums(cbn)==5,] 

Is there a way to evaluate it row by row and only store where the sum is
equal to 5, maybe it reduces cost of computation?
-- 
View this message in context: http://www.nabble.com/expand.grid-overflows--tf4820635.html#a13791428
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list