Compile a Stan model and return the model file.
Source:R/tar_stan_compile.R
tar_stan_compile_run.RdNot a user-side function. Do not invoke directly.
Arguments
- stan_file
(string) The path to a
.stanfile containing a Stan program. The helper functionwrite_stan_file()is provided for cases when it is more convenient to specify the Stan program as a string. Ifstan_fileis not specified thenexe_filemust be specified.- quiet
(logical) Should the verbose output from CmdStan during compilation be suppressed? The default is
TRUE, but if you encounter an error we recommend trying again withquiet=FALSEto see more of the output.- stdout
Character of length 1, file path to write the stdout stream of the model when it runs. Set to
NULLto print to the console. Set toR.utils::nullfile()to suppress stdout. Does not apply to messages, warnings, or errors.- stderr
Character of length 1, file path to write the stderr stream of the model when it runs. Set to
NULLto print to the console. Set toR.utils::nullfile()to suppress stderr. Does not apply to messages, warnings, or errors.- dir
(string) The path to the directory in which to store the CmdStan executable (or
.hppfile if using$save_hpp_file()). The default is the same location as the Stan program.- pedantic
(logical) Should pedantic mode be turned on? The default is
FALSE. Pedantic mode attempts to warn you about potential issues in your Stan program beyond syntax errors. For details see the Pedantic mode chapter in the Stan Reference Manual. Note: to do a pedantic check for a model without compiling it or for a model that is already compiled the$check_syntax()method can be used instead.- include_paths
(character vector) Paths to directories where Stan should look for files specified in
#includedirectives in the Stan program.- cpp_options
(list) Any makefile options to be used when compiling the model (
STAN_THREADS,STAN_MPI,STAN_OPENCL, etc.). Anything you would otherwise write in themake/localfile. For an example of using threading see the Stan case study Reduce Sum: A Minimal Example.- stanc_options
(list) Any Stan-to-C++ transpiler options to be used when compiling the model. See the Examples section below as well as the
stancchapter of the CmdStan Guide for more details on available options: https://mc-stan.org/docs/cmdstan-guide/stanc.html.- force_recompile
(logical) Should the model be recompiled even if was not modified since last compiled. The default is
FALSE. Can also be set via a globalcmdstanr_force_recompileoption.