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