RE: [Rd] Very Long Expressions

From: Prof Brian Ripley <>
Date: Tue 25 Jan 2005 - 03:03:55 EST

On Mon, 24 Jan 2005, McGehee, Robert wrote:

[Instructions to the R developers deleted.]

> Secondly, the ?options help (thanks for everyone who reminded me about
> this), says that expressions can have values between 25...100000.
> However, if the original example is set past 4995 on my computers, I
> receive a stack overflow.

More accurately, you caused a protection stack overflow.

>> eval(parse(text = paste(rep(1, 4996), collapse = "+")))
> Error: protect(): stack overflow
> I'm pointing this out not because I will ever approach anywhere near
> this level of nesting, but perhaps that options(expression=5000+) might
> not be meaningful anyway, (unless there are
> processor/compilation-specific ways of getting rid of this stack
> overflow). If so, one might considering lowering the range of valid
> expressions values in the help file.

It's the protect stack you are overflowing, and there are ways to increase that (look at the command-line flags) and other nested computations that do not protect repeatedly.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Tue Jan 25 02:10:36 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:41 EST