Package 'staninside'

Title: Facilitating the Use of Stan Within Packages
Description: This package provides helper functions that can be used for integrating Stan code driven by the CmdStanR package. Using CmdStanR and pre-written Stan code can make package installation easy and less prone to fail because it removes the need for Rcpp and RStan packages(and their dependencies). Using CmdStanR will also afford users the opportunity to use the latest developments within CmdStan. However, building these packages requires some work and this package provides tools to assist with that,
Authors: Michael DeWitt [aut, cre]
Maintainer: Michael DeWitt <[email protected]>
License: MIT + file LICENSE
Version: 0.0.3
Built: 2024-11-11 03:14:04 UTC
Source: https://github.com/medewitt/staninside

Help Index


Clear Stan Cache

Description

This function clears anything that may exist in the Stan Cache. Most Commonly if you are using the CmdStan backend, you'll have items in your cache.

Usage

clear_stan_cache(pkgname)

Arguments

pkgname

a string, the name of the package

Value

invisible null

Warning

This will removed cached models and requires that rappdirs is installed


Copy Stan Models

Description

This function extracts the Stan Code from a Package and then copies it to your user cache locally.

Usage

copy_models(pkgname = "staninside", local_location = NULL)

Arguments

pkgname

a string, the name of the package

local_location

a file path representing the desired location of the local copy.

Value

file path of newly created files

Examples

local_location <- tempdir()
copy_models(pkgname = "staninside", local_location  = local_location)

Find Stan Code

Description

This function looks for Stan code within a given R package a returns a list with the Stan code location within the package and the text of the code,

Usage

find_stan_code(pkgname = "staninside")

Arguments

pkgname

a string, the name of the package in which to look for the Stan code.

Examples

find_stan_code(pkgname = "staninside")

Create Package Infrastructure for Stan Package

Description

Create directory and helper files for a Stan package using CmdStanR

Usage

setup_stan_package(loc = NULL, use_all = TRUE)

Arguments

loc

a file.path indicating package root with a default of the current working directory

use_all

a logical indicating if each section of Stan code should have it's own directory with a default of TRUE

Value

invisible null

Examples

# Create Temporary Directory
temp_dir <- tempdir()

# Now setup the structur
setup_stan_package(loc = temp_dir)

# Examine output

list.files(temp_dir, recursive = TRUE)