Hi:
2^40
[1] 1.099512e+12
Do you have enough memory for almost 1.1 trillion rows and 40 columns?
This is a good example of the 'power law' that Stephen Strogatz
discussed in
his New York Times article today:
http://opinionator.blogs.nytimes.com/2010/03/28/power-tools/?hp
HTH,
Dennis
On Mon, Mar 29, 2010 at 8:27 PM, Bogaso <bogaso.christofer@gmail.com>
wrote:
>
> Hi, good morning,
>
> I got following error which looks strange to me while executing this code :
>
> > temp <- expand.grid(rep(list(c(1,0)),40))
> 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
>
>
> However if I put a small number like 12 in place of 40, it is working fine.
> A moderately bigger number than 10 like 30 give a memory related error :
>
> > temp <- expand.grid(rep(list(c(1,0)),20))
> Warning messages:
> 1: Reached total allocation of 1535Mb: see help(memory.size)
> 2: Reached total allocation of 1535Mb: see help(memory.size)
> 3: In attributes(.Data) <- c(attributes(.Data), attrib) :
> Reached total allocation of 1535Mb: see help(memory.size)
> 4: In attributes(.Data) <- c(attributes(.Data), attrib) :
> Reached total allocation of 1535Mb: see help(memory.size)
>
> But I badly need to execute this code for a large number like 150 (which I
> dont think a big number at all). Is there any other way to do the same
> task?
> Your help will be highly appreciated.
>
> I am working with R-2.10.1 within Vista with a 3gb RAM.
>
> Thanks
>
> --
> View this message in context:
>
http://n4.nabble.com/Problem-with-expand-grid-function-tp1740345p1740345.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]