R-beta: memory problem vith "dist" on W95

Martin Maechler maechler at stat.math.ethz.ch
Fri Oct 17 18:31:06 CEST 1997

>>>>> "Andrea" == Andrea Rossetti <rossetti at stat.unipg.it> writes:

    Andrea> Using Rseptbeta for Windows 95 I encountered this problem:

    >> library(mva)
    >> data(quakes)
    >> dist(quakes)

	>>> Error: memory exhausted

What exactly did you expect?
Did you realize that you asked for the lower triangle of a matrix of dimension
1000 x 1000 ?

    Andrea> I'm using a pentium 133 with 32 MB ram memory!

Here is some code, I run on an alpha version of R under Unix (Solaris):

> gc()
Garbage collection ...
137781 cons cells free (68%)
1783k bytes of heap free (91%)
> library(mva)
> data(quakes)
> gc()
134657 cons cells free (67%)
1696k bytes of heap free (86%)
> d.q <- dist(quakes)

134622 cons cells free (67%)
1614k bytes of heap free (82%)
Error: could not allocate memory 2 size: 499501> 
> dim(quakes)
[1] 1000    5
> d.tq <- dist(t(quakes))
> d.tq
               long      lat    depth      mag
lat       6334.5257                           
depth    12514.0041 7966.702                  
mag        814.7739 5532.396 11855.18         
stations  1851.3412 4675.363 11173.16 1137.370

    Andrea> What I must to do?

Actually, I don't even know if this is possible in Windows; I haven't used
any windows version of R recently.

In Unix, I start R by

	R -v 20
which reserves 20 Megabytes for ``vector data'' (aka `heap').

Then I can do 
	d.q <- dist(quakes)

d.q then contains half a million numbers and you don't want to see them !!
 {I think it is even more a memory problem to print it to your screen, since
  it is an object of class "dist" with its own print method
  which displays all numbers formatted nicely ...}

    Andrea> Thanks and excuse me for my english!

No need for an excuse;  for a mailing list like this, 
English is just a mean of transportation for exchanging INFORMATION ..

A nice weekend to everyone!
-- Martin
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