ZABALZA-MEZGHANI Isabelle wrote:
Hello,

I have implemented a method which uses sink to follow the progression status
of an iterative process (Below is part of the code)


I have already used such kind of code with no problem. Today, I get a "sink stack is full" error. I wonder if it could be linked with the fact that my .RData has a large size (around 7 Mo) ???


Every time you do a sink('filename') call R keeps track of where the output was going before, so when you do sink() it goes back. Example:


 sink('fnord')
  print(1)  # goes to file 'fnord'
    sink('foobar')
      print(2) # goes to file 'foobar'
    sink()
  print(3) # goes to 'fnord'
 sink()
   # now back to normal.

R has a limit on how deeply nested sink()s can be. A quick test:

> for(f in 1:1000){
+ sink(paste(f,'-sink'))
+ print(1)
+ }

got up to 20. This is defined in connections.c in the source code:

src/main/connections.c:#define NSINKS 21

If you really want to nest sink()s deeper than that then you will have to change this parameter and recompile R. More likely is that you are doing unneccessary sink()s because of the iterative nature of your code (which wasn't attached because I think R-news strips out attachments).

Baz

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to