knitr-stan: Register knitr engine for stan code

knit_engines_set_cache_stanR Documentation

Register knitr engine for stan code

Description

This is a simple alternative to cmdstanr::register_knitr_engine(). Chunk code is not compiled, but just written to a file with decent caching to facilitate showing the usage of cmdstanr::cmdstan_model().

Usage

knit_engines_set_cache_stan(cache_stan_prefix = NULL)

Arguments

cache_stan_prefix

Prefix for output files. A relative path is evaluated from the source file.

Details

Stan file is automatically named after the chunk label, .i.e., "{cache_stan_prefix}{label}.stan".

Set cache_stan to TRUE or FALSE for stan chunks so that output.var can be omitted. Then set it to the chunk label of stan code for dependent R chunks.


heavywatal/rwtl documentation built on April 29, 2024, 2:02 a.m.