[R] expand.grid problem

Muhammad Subianto subianto at gmail.com
Thu Oct 13 12:19:47 CEST 2005


Hi all,
I want to make all possible combination from dataset below:
  V1   <- c(0,1,2)
  V2   <- c(0,1)
  V3   <- c(0,1)
  V4   <- c(0,1)
  V5   <- c(0,1)
  V6   <- c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
  V7   <- c(0,1,2,3,4,5,6)
  V8   <- c(0,1)
  V9   <- c(0,1)
  V10  <- c(0,1)
  V11  <- c(0,1)
  V12  <- c(0,1)
  V13  <- c(0,1)
  V14  <- c(0,1)
  V15  <- c(0,1,2,3,4,5,6,7,8,9)
  V16  <- c(0,1,2,3,4,5,6)
  V17  <- c(0,1,2,3,4,5,6,7,8)
  V18  <- c(0,1,2,3,4,5)
  V19  <- c(0,1)
  V20  <- c(0,1,2,3,4,5,6,7)

When run expand.grid I found a problem:
 >   all.V  <- 
expand.grid(V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20)
Error in rep.int(rep.int(x, rep.int(rep.fac, nx)), orep) :
        invalid number of copies in rep()
In addition: Warning message:
NAs introduced by coercion
 >  

Then I try to reduce:
 >   all.V.miss  <- 
expand.grid(V1,V2,V3,V4,V5,V7,V8,V9,V10,V11,V17,V18,V19,V20)  
Error: cannot allocate vector of size 36288 Kb
 >
What is that? Is this about memory or I must run on machine 64bit?

Regards, Muhammad Subianto
P4 2.0GHz 512MB RAM

 > R.version$platform
[1] "i686-redhat-linux-gnu"
 > R.version$major
[1] "2"
 > R.version$minor
[1] "1.1"
 > R.version$year
[1] "2005"
 > R.version$month
[1] "06"
 > R.version$language
[1] "R"




More information about the R-help mailing list