[R] 'combinations' in gtools and stack overflow

Ho-Joon Lee lee at molgen.mpg.de
Mon Feb 14 18:31:03 CET 2005


Thank you for your replies, David and Brian.

The function 'combn' in the package "combinat" works really fine without 
using any particular options.
Thanks a lot again for referring me to the package, David.

On the other hand, I do not know the meaning of "stack overflow" 
technically and am not interested in that.
It was the first time that I got the error.
But I am now, thanks to Brian, able to handle it by starting R with the 
following command-line option:

--max-ppsize=100000,

which is described in Appendix B in 'An Introduction to R'.
This is the only thing I can find in the material about 'stack'.

Kind regards,

Lee

Prof Brian Ripley wrote:

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




More information about the R-help mailing list