I am running into C stack usage problems when using the R package Runuran in RStudio. The following MWE is taken from ?pinv.new:
require(Runuran)
## Create a sample of size 100 for N(0,1)
pdf <- function (x) { exp(-0.5*x^2) }
gen <- pinv.new(pdf = pdf, lb = -Inf, ub = Inf)
Error: C stack usage 7969212 is too close to the limit
The C Stack information is
> Cstack_info()
size current direction eval_depth
7969177 12880 1 2
The interesting thing is: The same code works perfectly fine in R via terminal or via the R GUI, just not in RStudio.
I have uninstalled and re-installed both R and RStudio, the problem continued to exist. My current specifics: R version 4.0.2 (2020-06-22), RStudio version 1.3.1093, macOS Catalina (10.15.6).
I appreciate any advice!
ADDED: When I am using RMarkdown in RStudio with the exact same code, the error does not occur! Now I am completely clueless.
thanks, the linked answer did not help resolve my issue (my 'ulimit' is unlimited). It is also not clear to me why this issue is only present via running in RStudio (btw, it's not only on my computer, my colleagues can reproduce above error message), and not in R via GUI or console.
I get the identical result. I'll open a github issue:
No problem in terminal, whether root or not. No problem with the code block in an RMarkdown chunk. Fail in executing the block from CTRL-ENTER in an R script, with the Console pane, but not in the Terminal pane.
Thank you, technocrat, for putting the issue on GitHub! For users looking for a workaround: It was suggested that a "workaround could be to turn off auto refresh on the environment pane". I can confirm that this resolved the issue in my case!