I am writing an R package that includes various Stan models. I hope to run these models using
cmdstanr rather than
rstan but I can only find guidance on using
rstan in packages.
Should I just follow that guidance but include
cmdstanr and just never use the
rstan material? Or is there a better way?
Do you want/need to ship precompiled models inside your package, or are you fine with a package that (like
brms) compiles the models at runtime?
I dont think there is any special guidance written down for cmdstanr, as there isnt really anything particulary special you need to do (not makefile stuff or anything of that sort).
I have a minimal package that uses cmdstanr to sample here https://github.com/rok-cesnovar/misc/tree/master/democmdstanr
Hopefully that may help.
Precompiled models is what I am planning to use.
Very helpful, thank you. I have been trying to use the step by step guide [Step by step guide for creating a package that depends on RStan • rstantools] and that creates a vastly more complicated package with lots of references to
I also recommend checking out @wlandau’s new R package that helps you make a package with cmdstanr that has precompiled models:
It’s basically like rstantools but for cmdstanr.
Many thanks. I’ll give it a try.