Error in prep_call_sampler(object) : could not find function “prep_call_sampler”


As the title indicates, when I run the the example (8 schools) code as below, the error regarding prep_call_sampler(object) appears. Please note that before I submitted this ticket, I did a quick check online, for a*b within the model, it has been specified as a * b, and my operation system is Win 10.

Thanks for your input in advance.

The prep_call_sampler function comes with the rstan package

so there is no way it cannot be found when the rstan package is installed properly.
My guess is that rstan was installed while a previous rstan was loaded or else there were stanfit or stanmodel objects from a previous version of rstan in R’s global environment when you tried to install the new rstan or something else weirdly specific to that laptop. I would suggest closing all R sessions, opening up a new one without bringing in any stanfit or stanmodel objects (including those in the .RData file) and calling


then do

install.packages("", repos = NULL)


Hi Ben,

Thank you so much!

Believe or not, I did not delete or remove anything. Just rerun the statement as I did last night at home. It works now…

I am really sick of it…

Ben, thank you so much for your continuous and instant input and help!!!