Error on rstudio cloud executing rstan example code

Hi folks,
I'm pretty novice with R/Rstudio and lately trying to get my feet wet with it. So I've copied some elses project and playing around with the code to familiarize myself with R/Rstudio and I've been getting the following error when executing part of the code

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/BH/include/boost/smart_ptr/shared_ptr.hpp:28:0,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/BH/include/boost/shared_ptr.hpp:17,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat/fun/LDLT_factor.hpp:7,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat/err/check_ldlt_factor.hpp:6,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat.hpp:34,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math.hpp:4,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-libr
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command '/opt/R/3.6.0/lib/R/bin/R CMD SHLIB filef725fa81cc.cpp 2> filef725fa81cc.cpp.err.txt' had status 1
Error in sink(type = "output") : invalid connection

Any ideas what going wrong here? The code examples are using stan if that helps.


It would be more helpful to actually see the code that produces that error message, ideally, could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

Or if the project is public, share the link to it

Thanks, yeah sure the project is public here is the link!

From that project I am running the file /bayes_sparse_regression/linear_regression.R

The error appears when executing line 24 form the above file.

That is a link to a GitHub repo, not to a RStudio Cloud project, since you have posted on this category, I suppose you have cloned that github repo into a RStudio Cloud project. Could you please share a link to that project? Is less likely that some one is going to clone the repository on his own machine just to try to reproduce your issue.

Sorry my bad I understood differently.
Here's the link to the project.


I suppose there's no solution to the problem?

Thanks for the project link. That (and ideally a reprex) really makes it easier on people who'd like to help.

So, there's a lot going on in this that doesn't appear documented. Is there a companion article or curriculum to follow?

Also, this repo is focused on rstan. Was that Your goal? stan has a great community site for stan specific questions here:

Were you maybe looking for more of a intro to R?

Thanks for the reply.

My goal was to play around with R and stan at the same time while exploring the R interface to stan.

Although, I would say that I'm a novice R user (i.e. I don't know the in and outs of R or the whole R ecosystem) but I believe that I'm to a degree very familiar with the basics, thank you though!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.