shinystan icon indicating copy to clipboard operation
shinystan copied to clipboard

Allow specifying an environment when calling launch_shinystan

Open jgabry opened this issue 9 years ago • 0 comments

From @paul-buerkner in #109:

My idea was that launch_shinystan could have an env (or similar named) argument to specify the environment to look for the objects. With regard to brms, I wouldn't require users to specify this argument. Rather, it would be set automatically be the function calling shinystan, e.g:

launch_shiny.brmsfit <- function(x, rstudio = getOption("shinystan.rstudio"), ...) {
  y <- model.response(model.frame(x))
  y_rep <- predict(x, summary = FALSE)
  shinystan::launch_shinystan(x$fit, rstudio = rstudio, env = environment(), ...)
}

I am not sure though, if this is the best way to find y and y_rep computed within the function calling shinystan.

jgabry avatar Feb 24 '16 16:02 jgabry