R: Create the skeleton of a new R package with Stan programs

rstan_package_skeleton {rstantools} | R Documentation

## Create the skeleton of a new R package with Stan programs

### Description

The `rstan_package_skeleton` function helps get you started developing R packages that interface with Stan via the rstan package. As of rstantools v1.5.0, `rstan_package_skeleton` calls `usethis::create_package` (instead of `utils::package.skeleton`) and then makes necessary adjustments so that the package can include Stan Programs that can be built into binary versions (i.e., pre-compiled like rstanarm).

See the See Also section below for links to recommendations for developers and a step by step walk-through of what to do after running `rstan_package_skeleton`.

### Usage

    rstan_package_skeleton(path, fields = getOption("devtools.desc"),
      rstudio = TRUE, open = TRUE, stan_files = character(), travis = TRUE)

### Arguments

`path` | A relative or absolute path to the new package to be created (terminating in the package name).
`fields, rstudio, open` | See `usethis::create_package`.
`stan_files` | A character vector with paths to `.stan` files to include in the package (these files will be included in the `src/stan_files` directory). If not specified then the `.stan` files for the package can be manually placed into the appropriate directory later.
`travis` | Should a `.travis.yml` file be added to the package directory? Defaults to `TRUE`. The file has some settings already set to help with compilation issues, but we do not guarantee that it will work on travis-ci without manual adjustments.

### Note

This function downloads several files from rstanarm package's GitHub repository to facilitate building the resulting package. Note that rstanarm is licensed under the GPL >= 3, so package builders who do not want to be governed by that license should not use the downloaded files that contain R code (that said, Rcpp is GPL, so not using the rstanarm files is not the only thing impeding use of other licenses). Otherwise, it may be worth considering whether it would be easier to include your `.stan` programs and supporting R code in the rstanarm package.

### See Also

- The rstanarm repository on GitHub.

- Guidelines and recommendations for developers of R packages interfacing with Stan and a demonstration getting a simple package working can be found in the vignettes included with rstantools and at http://mc-stan.org/rstantools/articles/.

- After reading the guidelines for developers, if you have trouble setting up your package let us know on the the Stan Forums or at rstantools issue tracker.

- The useR2016 presentation How to Use (R)Stan to Estimate Models in External R Packages.

[Package rstantools version 1.5.0 Index]