Learn R Programming

staninside

The goal of staninside is to facilitate the use of CmdStanR and packages leveraging Stan code.

Installation

From Github:

remotes::install_github("medewitt/staninside")

Alternatively, try r-universe:

# Enable this universe
options(repos = c(
    medewitt = 'https://medewitt.r-universe.dev',
    CRAN = 'https://cloud.r-project.org'))

install.packages('staninside')

Motivation

CmdStanR is a fantastic resource for interacting with Stan. The benefits include using the latest version of Stan and associated feature (which may not be available to RStan), no need for Rcpp dependencies, and licensing (BSD vs GPL3). Personally, the ability to ship packages with the raw Stan code allows users to directly interact with the code and update it based on their needs.

One issue that staninside seeks to solve is the prohibition by CRAN of manipulating a user’s files:

Packages should not write in the user’s home filespace (including clipboards), nor anywhere else on the file system apart from the R session’s temporary directory (or during installation in the location pointed to by TMPDIR: and such usage should be cleaned up). Installing into the system’s R installation (e.g., scripts to its bin directory) is not allowed.

Per https://cran.r-project.org/web/packages/policies.html

Staninside seeks to resolve this issue by providing a framework for package authors who wish to use Stan and CmdStanR to stay in compliance with CRAN Policies. This is done by providing helper functions with write and compile Stan code from within a package to the user’s package cache using the rappdirs package.

Code of Conduct

Please note that the staninside project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('staninside')

Monthly Downloads

150

Version

0.0.4

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Michael DeWitt

Last Published

July 30th, 2025

Functions in staninside (0.0.4)

clear_stan_cache

Clear Stan Cache
setup_stan_package

Create Package Infrastructure for Stan Package
find_stan_code

Find Stan Code
copy_models

Copy Stan Models
staninside-package

staninside: Facilitating the Use of 'Stan' Within Packages