Hi,
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 :) )
Thomas
>version
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 1
minor 7.1
year 2003
month 06
day 16
language R
On Mon, 11 Aug 2003, "Untern?hrer Thomas, uth" wrote:> 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.I don't think it is a memory problem. From your error message, the object stat cannot be found. Have you initialised stat before the loop? -- Cheers, Kevin ------------------------------------------------------------------------------ "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage (1791-1871) ---- From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)