2

I am thoroughly stumped as to what is going on in the following example:

library(ggplot2)
library(gridExtra)
dd = data.frame(th1 = rnorm(10), index = 1:10)
g = ggplot(dd) +
  geom_step(aes(x = index, y = th1))
grid.arrange(g,g)

which gives the following error

"Error: evaluation nested too deeply: infinite recursion / options(expressions=)?"

Originally the example would give the error "Error: C stack usage is too close to the limit" but as per this answer changed the stack limit ulimit -s unlimited.

I am really confused as to what is causing this to happen. I know that an issue was raised with the ggplot2 package but was closed as a bug in gridExtra.

This issue has only arisen for me on updating my R package installations so I assume it is to do with an update to one of grid, gridExtra or ggplot2. I have a package with numerous plot functions that depend on grid.arrange and would love to know what is causing the issue here.

Extra info

Other potentially useful information for solving this:

sessionInfo

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] gridExtra_0.9.1 ggplot2_2.0.0  

loaded via a namespace (and not attached):
[1] labeling_0.3     colorspace_1.2-6 scales_0.3.0     plyr_1.8.2      
[5] tools_3.2.2      gtable_0.1.2     Rcpp_0.12.3      munsell_0.4.2

Cstack

> Cstack_info()
      size    current  direction eval_depth 
        NA         NA          1          2 

expressions option

> getOption("expressions")
[1] 5000

Can anyone shed any light? Do others reproduce the same issue? Would love to hear any suggestions from anybody. Thanks

Community
  • 1
  • 1
jamieRowen
  • 1,509
  • 9
  • 14
  • 5
    Works fine for me on r69964 (The RC as of 10 days ago) on OS X 10.11.3. BUT, your gridExtra is old! It's at 2.0.0 so upgrade and see if the problem remains. – Bryan Hanson Feb 04 '16 at 22:41
  • Interesting, I wonder if updating my R version will solve this. I am still intrigued as to what might be causing this though. I will update and re-test. – jamieRowen Feb 04 '16 at 22:49
  • Good suggestion, solves the problem. What is now mystifying me most is how on earth I have ended up with such an old version of gridExtra. I tend to make a point of updating all my R packages routinely as I use for teaching. @baptiste just twigged that you are the author of the package, thanks for helping. That's not to ignore Bryan in my gratitude. Out of curiosity when was gridExtra_0.9.1 the current CRAN release? – jamieRowen Feb 04 '16 at 23:05
  • October 2014. See https://cran.r-project.org/web/packages/gridExtra/news.html – Sean Hughes Feb 04 '16 at 23:41
  • Thanks for the comment – jamieRowen Feb 05 '16 at 09:33

0 Answers0