[R] Memory-problem?

"Unternährer Thomas, uth" uth at zhwin.ch
Mon Aug 11 12:44:18 CEST 2003


I have a big problem with my R-script. It seems to be a memory problem, but I'm not sure.

My script:

test.window <- function(stat, some arguments){
  several ifs and ifs in ifs (if(){...if(){...}})

for (ii in 1 : length(data)){  ## data is a vector of length 2500

   stat <- test.window( some arguments )  
     ## there are 15 arguments including a "big" list (stat), vectors and scalars
   plot.points(stat, some other arguments)


If I use the functions test.window and plot.points with the arguments (test.window(stat,...)) 
the for-loop stops at point ii = 1200 with an error message (error: Object stat not found). 
In every loop the object stat is used. This error could not be the real problem I think.

If I use the functions without the arguments (stat <- test.window(), 
the functions are defined without arguments too) the script works fine.
I use the variable globaly then I think, isn't it?

So it seems to me the problem is my memory and I was doing the following then:
>round(memory.limit()/1048576.0, 2)
[1] 510.51

I do have 512MB of memory... I think I can't give R more memory, isn't it?

In the next step I try to do the same in S-Plus.
In S-Plus I can't use the function without any arguments (really?)
The error:
 object "stat" must be assigned locally before replacement

Including the arguments give me not the same result like R give me if I use the function without arguments.

Can anybody help me? Is it a memory-problem? What can I do?
I don't want to use the function without arguments (bad programming style).

Thanks for your help and comments in my problems before and now

(and sorry about my english, it's terrible but I work on it :) )


platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
major    1              
minor    7.1            
year     2003           
month    06             
day      16             
language R

More information about the R-help mailing list