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 |
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.
clear_stan_cache(pkgname)
clear_stan_cache(pkgname)
pkgname |
a string, the name of the package |
invisible null
This will removed cached models and requires that rappdirs
is installed
This function extracts the Stan Code from a Package and then copies it to your user cache locally.
copy_models(pkgname = "staninside", local_location = NULL)
copy_models(pkgname = "staninside", local_location = NULL)
pkgname |
a string, the name of the package |
local_location |
a file path representing the desired location of the local copy. |
file path of newly created files
local_location <- tempdir() copy_models(pkgname = "staninside", local_location = local_location)
local_location <- tempdir() copy_models(pkgname = "staninside", local_location = local_location)
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,
find_stan_code(pkgname = "staninside")
find_stan_code(pkgname = "staninside")
pkgname |
a string, the name of the package in which to look for the Stan code. |
find_stan_code(pkgname = "staninside")
find_stan_code(pkgname = "staninside")
Create directory and helper files for a Stan package using CmdStanR
setup_stan_package(loc = NULL, use_all = TRUE)
setup_stan_package(loc = NULL, use_all = TRUE)
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 |
invisible null
# Create Temporary Directory temp_dir <- tempdir() # Now setup the structur setup_stan_package(loc = temp_dir) # Examine output list.files(temp_dir, recursive = TRUE)
# Create Temporary Directory temp_dir <- tempdir() # Now setup the structur setup_stan_package(loc = temp_dir) # Examine output list.files(temp_dir, recursive = TRUE)