On Thu, 2005-10-13 at 12:19 +0200, Muhammad Subianto
wrote:> 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
It's all about memory. In your first example, you are trying to create
a data frame with 20 columns and 54 billion (thousand million) rows.
Just to store this amount of data as an array of doubles you would need
8 terabytes of memory. You are being a bit optimistic trying to do it
with only 500 Megabytes.
Martyn
> > 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"
-----------------------------------------------------------------------
This message and its attachments are strictly confidential. ...{{dropped}}