[R] Contextstack overlow

Duncan Murdoch murdoch at stats.uwo.ca
Thu Dec 18 18:19:41 CET 2008

On 12/18/2008 12:00 PM, Ranney, Steven wrote:
> All - 
> I have a number of rows that I am assigning length classes to via
> l.class<-with(wae,
>   ifelse((Length>=120)&(Length<130),"125",
>   ifelse((Length>=130)&(Length<140),"135",
>   ifelse((Length>=140)&(Length<150),"145",
>   ifelse((Length>=150)&(Length<160),"155",
>   ifelse((Length>=160)&(Length<170),"165",
>   ifelse((Length>=170)&(Length<180),"175",
>   ...
>   ifelse((Length>=700)&(Length<710),"705",
>   "substock")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
> There are a total of 60 lines and I get a "contextstack overflow" error at line 50.  From reading the archives, it looks as though this is a hard limit but can be changed rather easily.  Unfortunately, I haven't found any specifics on how to change this limit.  Does anyone know how I can edit this upper limit?  

I wouldn't call it easy:  you would edit the source to gram.c or gram.y 
in src/main, changing a define, and then recompile R.

However, it's not needed for the sort of thing you're doing.  Just use 

Duncan Murdoch

More information about the R-help mailing list