Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for Stan engine from rstan package #1602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions R/engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ eng_julia = function(options) {
## Compiles Stan model in the code chunk, creates a stanmodel object,
## and assigns it to a variable with the name given in engine.opts$x.
eng_stan = function(options) {

# call rstan's engine if it exists
if (requireNamespace("rstan", quietly = TRUE)) {
rstan = asNamespace("rstan")
if (!is.null(rstan$eng_stan))
return(rstan$eng_stan(options))
}

# otherwise, delegate to builtin implementation
code = paste(options$code, collapse = '\n')
opts = options$engine.opts
## name of the modelfit object returned by stan_model
Expand Down