MyNixOS website logo
Description

Facilitating the Use of 'Stan' Within Packages.

Infrastructure and functions that can be used for integrating 'Stan' (Carpenter et al. (2017) <doi:10.18637/jss.v076.i01>) code into stand alone R packages which in turn use the 'CmdStan' engine which is often accessed through 'CmdStanR'. Details given in Stan Development Team (2025) <https://mc-stan.org/cmdstanr/>. Using 'CmdStanR' and pre-written 'Stan' code can make package installation easy. Using 'staninside' offers a way to cache user-compiled 'Stan' models in user-specified directories reducing the need to recompile the same model multiple times.

staninside

R-CMD-check Codecov testcoverage CRANstatus

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.

Metadata

Version

0.0.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows