[R] evaluation is nested too deeply: infinite recursion?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Mar 16 07:37:29 CET 2000


On Wed, 15 Mar 2000, Mathieu Ros wrote:

> hello R-users,
> I'm trying to port from S+4 a library called S2HTML.
> generic function HTMLExport, when called for a lm object, uses
> HTMLExport.lm which itself calls HTMLExport.list to export the summary.
> My problem is that HTMLExport.list may itself call HTMLExport (and so
> HTMLExport.list) for  components of the lists that are lists themselves
> (like "terms" component of an lm object).
> I get the following error message in this case :
> Error in as.vector(x) : evaluation is nested too deeply: infinite
> recursion?
> I believe this error is due to a too deep recursion but maybe there is a
> way to overcome this error (shouldn't it be a warning?).

It should be an error. You do want it to stop before you do too much
damage. S behaves in the same way. You can change the limit by setting an
option: see ?options and look for `expressions'. (This option was put there
on all platforms after a couple of examples of crashes caused by
over-running OS structures such as the process stack.)

The default limit in R is higher than that in S-PLUS, at least on the
versions I have.

> I would be very grateful if anybody could help me or give me a hint.
> thanks,
>     Mathieu
> PS : code of these functions is in my last 2 mails.

You could try dumping the frames and examining the state when it does
give you an error.  It is very unlikely that you should be getting 
a nesting 500 deep, but it is possible that R is `leaking' levels
(we have corrected one such bug fairly recently).  About the only examples
in S where the limit needs to be increased involve symbolic manipulations
such as symbolic differentiation.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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