[R] tapply, sorting and the heap

Thomas Lumley thomas at biostat.washington.edu
Fri Mar 3 17:29:52 CET 2000


On Fri, 3 Mar 2000, Strumila, John wrote:

> howdy gurus,
> 
> I'm new and green and I was hoping for a tiny bit of your expertise.
> 
> I'm running out of virtual memory (heap?) when summing using tapply.  I've
> already used --vsize=90M on my hpux machine.  (details below)
> 
> Can I pre-sort or something to prevent my error?

Look at the rowsum() command. I think it will do what you want.

	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle


> 
> thanks,
> John Strumila
> john.strumila at corpmail.telstra.com.au
> 
> 
> > gc()["Vcells","total"]
> [1] 11796480
> > gcinfo(TRUE)
> [1] FALSE
> > t1<-tapply(trace$elapsed,list(trace$pid,trace$hv,trace$transno),sum)
> Garbage collection [nr. 11]...
> 104285 cons cells free (41%)
> 90082 Kbytes of heap free (98%)
> Garbage collection [nr. 12]...
> 102205 cons cells free (40%)
> 90050 Kbytes of heap free (98%)
> Garbage collection [nr. 13]...
> 103347 cons cells free (41%)
> 90131 Kbytes of heap free (98%)
> Garbage collection [nr. 14]...
> 105301 cons cells free (42%)
> 90188 Kbytes of heap free (98%)
> Error: heap memory (92160 Kb) exhausted [needed 209243 Kb more]
>        See "help(Memory)" on how to increase the heap size.
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list