[R] contextstack overflow

Steven Finch sfinch9 at hotmail.com
Tue Feb 20 15:31:39 CET 2007


Hello!

I written several implementations in R of Rémy's algorithm for
generating random ordered strictly binary trees on 2n+1 vertices.

One implementation involves manufacturing character strings like:

"X <- list(0,list(0,0))"

for the case n=2.  If I perform the following two steps:

cmd <- "X <- list(0,list(0,0))"
eval(parse(text=cmd))

then X becomes a true nested list in R.  This works fine for n=2,
but often for n=200, an error message:

Error in parse(text = cmd) : contextstack overflow

appears and execution stops.  Clearly there exists an upper bound
on the allowable depth of nestings in R!  Can this upper bound be
easily increased?

Other implementations avoid this problem, so this issue is not
crucial to me.  I do wish, however, to understand the limits of
this particular approach.  Thank you!

Steve Finch
http://algo.inria.fr/bsolve/

P.S.  If anyone else has written R code for generating random
trees (on a fixed number of vertices), I would enjoy seeing this!

_________________________________________________________________
Don’t miss your chance to WIN 10 hours of private jet travel from Microsoft® 
Office Live http://clk.atdmt.com/MRT/go/mcrssaub0540002499mrt/direct/01/



More information about the R-help mailing list