Knitr segfault

I’m writing lecture slides using LaTeX beamer and knitr, and regular R code all works: loading libraries (arm and mosaic (a teaching package)), lm, xyplot, etc.

I’m having segfaults just for loading the rstanarm library within the slides. I have a 43 slide lecture, and I add just library(rstanarm) and it segfaults. If I reduce my lecture down to just a single slide only loading the libraries, it will work. If I add a title page to this minimalist slide show, it will segfault.

I noticed there was someone else who had a problem with rstanarm in knitr Rnw file, and he never resolved his problem, but that was 2 years ago.

library(rstanarm) 

Earlier, I was able to load the library, but then LaTeX had a problem with the underscore in stan_glm, even located within a code chunk.

Is the bottom line still that rstanarm doesn’t work dependably within LaTeX/knitr documents, or is there a workaround now to make it less temperamental?

  • Operating System: Mac OS 10.14.6
  • rstanarm Version: 2.21.1
1 Like

Sorry for taking quite long to respond. Unfortunately I am really not sure what is the cause. Can you run rstanarm reliably outside of knitr? There was a lot of issues with Stan on Mac recently… :-(

@CHGreene welcome to the Stan forums and, like @martinmodrak said, sorry nobody responded sooner!

I just checked and I am able to use rstanarm in knitr successfully without any segfaults (I’m also on Mac but OS X10.15.5). Do you have a particular example you could share? That would help me look into it more since it’s possible that the examples I tried just happen not to trigger the problem.

1 Like