[Rd] Very Long Expressions

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 24 13:21:46 CET 2005

On Mon, 24 Jan 2005, Barry Rowlingson wrote:

> McGehee, Robert wrote:
>>> a <- eval(parse(text = paste(rep(1, 499), collapse = "+")))
> Another little investigation shows that if you type:
> 1+1+......+1
> at the > prompt (with over 498 '+1's) both R1.8.1 and R2.0.0 produce an error 
> message, so it would appear to be something specific to the eval() function 
> in R 2.0.x suppressing the error message.

It's not.  An error is being thrown whilst trying to print the message, as 
that is doing an evaluation, and recursive errors bail out without 
printing.  I suspect this is due to the deparsing changes in 2.0.0, but a 
simple fix is to make sure the call is not printed, as in

 	errorcall(R_NilValue, "evaluation nested too deeply: infinite 
recursion / options(expression=)?");

in eval.c:288  (You don't actually need to know as the problem is caused 
at the top-level expression immediately preceeding the error.)

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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list