Skip to content

Commit

Permalink
Merge pull request #26 from stemangiola/main
Browse files Browse the repository at this point in the history
Allow instantiate to build cmdstanr-based packages without install as source
  • Loading branch information
wlandau authored Oct 2, 2024
2 parents bf1c8cf + 3e24acd commit 6c27ed7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: Similar to 'rstantools' for 'rstan',
migrate from 'rstan' to the more modern 'cmdstanr'.
Packages 'rstantools', 'cmdstanr', 'stannis', and
'stanapi' are similar Stan clients with different objectives.
Version: 0.2.2.9000
Version: 0.2.2.9001
License: MIT + file LICENSE
URL: https://wlandau.github.io/instantiate/,
https://github.com/wlandau/instantiate
Expand Down
12 changes: 10 additions & 2 deletions R/stan_package_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@
#' @param library Character of length 1 or `NULL`, library path
#' to look for the package with the built-in Stan model.
#' Passed to the `lib.loc` argument of `system.file()`.
#' @param compile `TRUE` to compile the model and store the executable file
#' where the package is installed in `.libpaths()`. `FALSE` to
#' skip compilation and assume the model is already compiled,
#' which is usually the case.
#' @param ... Arguments passed to cmdstanr("cmdstan_model").
#' @examples
#' # Please see the documentation website of the {instantiate} package
#' # for examples.
stan_package_model <- function(
name,
package,
library = NULL,
cmdstan_install = Sys.getenv("CMDSTAN_INSTALL", unset = "")
cmdstan_install = Sys.getenv("CMDSTAN_INSTALL", unset = ""),
compile = FALSE,
...
) {
stan_assert_cmdstanr()
stan_assert(name, is.character(.), !anyNA(.), nzchar(.))
Expand Down Expand Up @@ -71,6 +78,7 @@ stan_package_model <- function(
cmdstanr("cmdstan_model")(
stan_file = stan_file,
exe_file = exe_file,
compile = FALSE
compile = compile,
...
)
}

0 comments on commit 6c27ed7

Please sign in to comment.