Roger D. Peng
2003-Sep-28 23:03 UTC
[Rd] infinite recursion during package installation with methods, setAs
I ran into a problem recently trying to update a package which uses S4 methods using a recent beta of R. I think I can reproduce it with a simple example. I have package called `testpkg' in directory testpkg/. In the R/ subdirectory of testpkg/ I have a file called testpkg.R which contains the following two lines: setClass("testpkg", representation(pts = "list")) setAs("testpkg", "numeric", function(from, to) as.numeric(unlist(from))) Then, in the main testpkg/ directory I have an empty `install.R' file and a dummy DESCRIPTION file (as well as an empty man/ subdirectory). When I run `R CMD INSTALL testpkg' I get the following output: marla:> R CMD INSTALL testpkg * Installing *source* package 'testpkg' ... ** R ** save image [1] "testpkg" Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Loading required package: testpkg Error during wrapup: evaluation is nested too deeply: infinite recursion? Loading required package: testpkg Error in options(x) : evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Execution halted ERROR: execution of package source for 'testpkg' failed ** Removing '/home/rpeng/install/R-beta/lib/R/library/testpkg' Is this expected? Did I specify something incorrectly? If I remove the setAs() call, everything installs fine. Furthermore, if I include a line like: setAs("numeric", "testpkg", function(from, to) list()) that doesn't seem to cause a problem. I only get the infinite recursion problem when the first argument to setAs() is the new class "testpkg". > version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status beta major 1 minor 8.0 year 2003 month 09 day 27 language R -roger
Martin Maechler
2003-Sep-29 10:41 UTC
[Rd] infinite recursion during pkg installation w/ methods, setAs
>>>>> "Roger" == Roger D Peng <rpeng@jhsph.edu> >>>>> on Sun, 28 Sep 2003 17:09:04 -0400 writes:Roger> I ran into a problem recently trying to update a Roger> package which uses S4 methods using a recent beta of Roger> R. I think I can reproduce it with a simple example. Roger> I have package called `testpkg' in directory Roger> testpkg/. In the R/ subdirectory of testpkg/ I have Roger> a file called testpkg.R which contains the following Roger> two lines: Roger> setClass("testpkg", representation(pts = "list")) Roger> setAs("testpkg", "numeric", function(from, to) as.numeric(unlist(from))) Yes, this *is* a problem in recent "R beta" versions. Doug Bates has reported something very similar to the R core.. So, it should hopefully be resolved "soon". Thank you very much, Roger, for reporting the problem! We *are* really very grateful if many people now switch from R 1.7.x to "1.8.0 beta" such that we can catch as many bugs as possible before release! Martin Roger> Then, in the main testpkg/ directory I have an empty Roger> `install.R' file and a dummy DESCRIPTION file (as Roger> well as an empty man/ subdirectory). Roger> When I run `R CMD INSTALL testpkg' I get the following output: Roger> marla:> R CMD INSTALL testpkg Roger> * Installing *source* package 'testpkg' ... Roger> ** R Roger> ** save image Roger> [1] "testpkg" Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Loading required package: testpkg Roger> Error during wrapup: evaluation is nested too deeply: infinite recursion? Roger> Loading required package: testpkg Roger> Error in options(x) : evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Error: evaluation is nested too deeply: infinite recursion? Roger> Execution halted Roger> ERROR: execution of package source for 'testpkg' failed Roger> ** Removing '/home/rpeng/install/R-beta/lib/R/library/testpkg' Roger> Is this expected? Did I specify something Roger> incorrectly? Roger> If I remove the setAs() call, everything installs Roger> fine. Furthermore, if I include a line like: Roger> setAs("numeric", "testpkg", function(from, to) Roger> list()) Roger> that doesn't seem to cause a problem. I only get the Roger> infinite recursion problem when the first argument to Roger> setAs() is the new class "testpkg". >> version Roger> _ Roger> platform i686-pc-linux-gnu Roger> arch i686 Roger> os linux-gnu Roger> system i686, linux-gnu Roger> status beta Roger> major 1 Roger> minor 8.0 Roger> year 2003 Roger> month 09 Roger> day 27 Roger> language R
Possibly Parallel Threads
- Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
- evaluation is nested too deeply: infinite recursion?
- 'R CMD check' fails with "evaluation nested too deeply: infinite recursion"
- Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
- infinite recursion when printing former S4 objects