Rstan_package_skeleton folder roles

Hello, someone with limited overall development experience here, working on their first rstan package. Very early versions of what I’m trying to do are working but I’m realizing that I don’t fully understand the folders that rstan_package_skeleton installs that are not part of the “normal” R package folder structure, namely /inst/include and /tools.

From the rstan developer guidelines ( I gather that /inst/include is meant for code chunks that may get reused and I was pointed to the rstanarms package. From there it seemed like reused stan code chunks are left in /src/stan_files and only re-used c++ code chunks are in /inst/include. Is this impression accurate and if I don’t have c++ code chunks (currently only the blank meta_header.hpp file is there) should I delete /inst for now?

In terms of /tools rstanarm only has the make_cc.R file that rstan_package_skeleton() automatically sets up. It seems like the purpose of the file is to make c++ classes from stan files but that’s all I can tell from reading documentation.

I’m sorry for my novice questions, I was just curious about the roles of these folders and what code I might be writing belongs in them (and no one I’m working with has much more experience than I do). If anyone knows of resources that might solve these types of questions in the future I would be glad to have them!
Thanks for your time

We changed things up a good bit for Stan 2.17.x and maybe not all of the documentation is current. As of now, /inst/include/ is meant for C++ code that is custom to your R package and there may not be any in your case (but you don’t need to delete anything). Conversely, src/stan_files/chunks is meant for Stan code that gets included in multiple Stan programs that are in the root of src/stan_files. To use this just do something like

#include chunks/license.stan

at the top of your Stan programs.

There is stuff in tools/ that is called when you do R CMD build mypackage and similar. The tools/ folder gets deleted in mypackage_1.0.tar.gz so you don’t need to touch it or even worry about it.

Thanks so much for your time, appreciate the work you all do.