Using CmdStanR in an R package

Hey, could anyone point me in the direction of learning how I can use CmdStanR models in an R package?

Mainly, I wonder if the fact the I wrote the models in the newer Stan version which rstan does not support (afaik) is going to be an issue moving forward.


You can find a minimal package that uses a model that is part of the package:

Let me know if you need any further explanations.

Thanks! This is very helpful.

My test function works well and using the function after load_all() actually compiles the model and run the sampling, but I also have several .Rprofile functions designed to overrule RStudio’s syntax check which throws errors at stuff like: array[N] int <lower = 0> dN.

Does load_all() ignore these kind of things and I can assume that it will work for users as long as they have cmdstan?