Has anyone written a package that uses cmdstanr models inside it?
I was writing a little package to test some things and I could use an example of how to organize things (how to handle the model compile, how to set up tests, etc. etc.).
Brms and the rethinking package use cmdstanr, but those build models on the fly to compile them so that is probably not a good comparison. I have seen some other packages like EpiNow2 that either use cmstanr already or are transitioning.
Thanks for the plug, @mike-lawrence. That’s actually more of a workflow archetype though. I’m also thinking about a pipeline package for Stan models (basically tarchetypes for cmstanr) but that won’t have any actual models in it.
Any good templates/packages that came out based on cmdstanr (brms mainly uses rstan) since then?
I was mostly interested in allowing as much as possible the one-line installation that is typical of R. I can compile the model on the fly and save it locally to avoid recompiation, but it is the installation process that bothers me.
You should define a .onLoad function in your package that tries to check whether the user has a valid CmdStan installation (see cmdstanr::cmdstan_version()). If it does not found one then run