Problems with rstanarm installation: object 'bayes_R2' not found


Hi all,
I recently updated my computer (windows). And trying to reinstall rstanarm. Rtools and Rstan seem to work, but for some reason rstanarm fails to load. I am getting this error:

error: package or namespace load failed for ‘rstanarm’:
object ‘bayes_R2’ not found whilst loading namespace ‘rstanarm’

I tried reinstalling…

Thank you very much!!!


You may have to do remove.packages("rstanarm") in a clean R session (without autoloading any old objects) and then install.packages("rstanarm") again.


Thank you @bgoodri for you suggestion.
It didn’t work :(
Just to make sure - clean r session is achieved by removing all objects (including hidden objects?)

Any other suggestions?

Thank you!


I have the same problem: After updating my R version to the latest (3.4.3) and re-installation of rstanarm I get the same error message as @Asher. I tried the remove.packages as proposed by @bgoodri but again, it did not work out (same error message). Rtools and Rstan work properly…

Any other suggestions?


OK. so I found a solution.
Apparently I had a R folder in Documents that remained after uninstalling. Also I found 3 other files in my Document folder that were associated with R.
I deleted this folder as well as these files and then reinstalled rstanarm. This did the trick.
Basicly I think removing rstanarm alone was not enough. One needs to remove all packages that the rastanarm requires. After deleting this folder, installing rstanarm installed many other dependent packages.
@Yve If when you reinstall rstanarm package you are only downloading and installing rstanarm (8mb) then you probably did not remove all dependent packages.


Thank you @pete - that worked for me.
I reinstalled rstantools and rstanarm (just using the “usual” procedure via remove.packages(“rstantools”) and reinstalled both packages. Rstanarm is now working - so maybe the newer version of rstantools also made the trick for @Asher.


Hi all,

none of the above exactly solved my problem, but installing the package rstantools did. Apparently it was not installed by neither rstan nor rstanarm.

After installing rstantools, installing rstanarm worked.

This was for a debian installation.