Standalone use of ode integrator in R


#1

Dear all,
I’m using rstantools to create a package including ODEs. And I’d like to use the ode integrator in an R function (named solve_odeTKTD). So, a standalone use of the functions created by expose_stan_functions("exec/ode_integrator.stan") but not in my session (what works perfectly), in the package I’m developing.

I saw this topic Saving the dso from expose_stan_functions that helped me for some steps. But maybe there is something simpler in the tools provided by rstantools since the function seems already in the models.hpp.


#2

There isn’t much in rstantools for this. Basically, you need to call expose_stan_functions once or maybe just stan_model to generate the C++ file and then copy that file into the src/ directory of your package. Then, do a lot of editing to get it to work like a normal R package that relies on Rcpp.


#3

Thank you Ben. I’ll focus on those functions. I begin to understand how they work.