Error in extract()



I have successfully run my stan code and I am interested in extracting the posterior distribution of my model.

I am receiving the following error:
Error in extract(, pars = “par1”) :
object of type ‘S4’ is not subsettable

However I can successfully extract them with:
junk <-, pars=“par1”);

Does anyone have any ideas why I am running into the extract problem? Also Note: I was previously able to extract these values with no problem, but have since then modified my R code making changes which should have no impact running STAN section, just moving sections that occurred after my STAN run into new R codes to simplify my original code, and have also terminated Rstudio (which is my user interface) and restarted - rerun, and received the error when using extract.

Thank you in advance.


I think you are clashing with the extract function in another package. Try using rstan::extract.


This is a good idea in general…


Thank you that worked!