[R] Problem with nested functions - functions nested too deeply in source code

Maximilian Kofler maximilian.kofler at umit.at
Fri May 7 14:21:47 CEST 2010

Duncan Murdoch <murdoch.duncan <at> gmail.com> writes:

> I doubt if that was the error message.  More likely you saw
> Error: evaluation nested too deeply: infinite recursion / 
> options(expressions=)?

Exactly this was the error message I recieved
>This isn't a case of the source being nested to deeply, but rather of the 
>evaluation being nested too deeply.  
> This happens in recursive algorithms when R runs out of 
> stack space, around 5000 calls deep.  Is it likely in your dataset that 
> a recursion depth of 5000 is reasonable?  In most cases this indicates a 
> programming error that leads to an infinite recursion, but there are 
> probably cases where a depth like that is reasonable.

I don't think that it is a programming error, because I succeyyfully 
calculated subgraph isomirphism with the algorithm, but with 
smaller input graphs. So the algorithm seems to work. 
I already tried to set options(expressions=500000), but 
then I cause a protection stack overflow: 

error:  protect(): protection stack overflow

Is the problem that too many objects are stored in the stack? 
If yes, somebody knows how to solve this 

thanks for your replies

More information about the R-help mailing list