Search code examples
r-packagestanrstan

Using rstan::rstan.package.skeleton to add to existing R package


I've already used devtools to create my package skeleton, then added a bunch of R code, metadata, documentation, etc. I would like to use rstan within this package. I understand that rstan::rstan.package.skeleton creates a package skeleton to facilitate this. So what is the best practice for augmented an existing package with the structure necessary to use rstan from that package? Thank you.


Solution

  • I would say to use rstan.package.skeleton to create the skeleton in a temporary directory and then copy the relevant stuff it creates into the package you created by devtools. This would include

    • cleanup and cleanup.win in the root of the directory
    • the tools directory
    • the exec directory
    • the inst/chunks subdirectory
    • the src directory
    • the R/stanmodels.R file
    • the DESCRIPTION file in the root of the directory

    For the DESCRIPTION file, you may just have to combine it by hand with whatever DESCRIPTION file you have currently.