[R] 'combinations' in gtools and stack overflow

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Feb 14 16:22:58 CET 2005


On Mon, 14 Feb 2005, Ho-Joon Lee wrote:

> Dear R-users,
>
> Let me ask about the 'stack overflow' error which I got when I used the 
> function 'combinations' in "gtools".
>
> The following is what I did:
>
> ---------
> library(gtools)
> options(expressions=1e5)
> combinations(500, 3, 1:500)
> # or combinations(400, 2, 1:400)
> Error: protect(): stack overflow
> ---------
>
> How can I overcome this error? Is there perhaps any other function to do this 
> more efficiently?

R --help lists a flag that you can use to increase the size of the protect 
stack.  It is also described in `An Introduction to R'.

-- 
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-help mailing list