stan_package_compile {instantiate} | R Documentation |
Compile the Stan models in an R package.
Description
Compile all Stan models in a directory, usually in a package.
Usage
stan_package_compile(
models = instantiate::stan_package_model_files(),
cmdstan_install = Sys.getenv("CMDSTAN_INSTALL", unset = ""),
verbose = TRUE,
quiet = FALSE,
pedantic = FALSE,
include_paths = NULL,
user_header = NULL,
cpp_options = list(),
stanc_options = list(),
force_recompile = getOption("cmdstanr_force_recompile", default = FALSE),
threads = FALSE,
...
)
Arguments
models |
Character vector of file paths to Stan model source code
files. Defaults to the Stan files in |
cmdstan_install |
Character of length 1, how to look for an installed copy of CmdStan. See https://wlandau.github.io/instantiate/ for details. Choices:
|
verbose |
Logical of length 1, whether to set the
|
quiet |
Argument to |
pedantic |
Logical of length 1, whether to activate pedantic
mode when compiling the Stan models. See the |
include_paths |
Argument to |
user_header |
Argument to |
cpp_options |
Argument to |
stanc_options |
Argument to |
force_recompile |
Argument to |
threads |
Argument to |
... |
Other named arguments to |
Details
If building a package using instantiate
, all Stan model files
must live in a folder called src/stan/
in the package source
directory.
Value
NULL
(invisibly). Called for its side effects.
See Also
Other packages:
stan_cmdstan_path()
,
stan_package_clean()
,
stan_package_configure()
,
stan_package_model_files()
Examples
if (identical(Sys.getenv("INSTANTIATE_EXAMPLES"), "true")) {
path <- tempfile()
stan_package_create(path = path)
stan_package_configure(path = path)
models <- stan_package_model_files(path)
list.files(file.path(path, "inst", "stan"))
stan_package_compile(models)
list.files(file.path(path, "inst", "stan"))
}