Carl Carl - 4 months ago 35
R Question

Shiny: Choose whether to run app in Window, in Viewer Pane or Externally

I have a shiny app that I distributed as a package. When I use the package/app on my computer it opens a new window within RStudio and runs the app there. When other people run the package/app on their computer it opens in Internet Explorer, which is problematic.

I changed my

code to include
, which prevents the app from opening in IE, but runs the app in the little viewer pane rather than opening a new window. I can't seem to find anywhere in the shiny documentation on how to tell
to open in an Rstudio window.

If I can tell
to run in the viewer pane I should also be able to run it in a Rstudio window. Does anyone know how?



I was able to resolve my issue with this code:

# Create ui and server
# Set Rstudio to run external
shinyApp(ui = ui, server = server) # runs externally
options(shiny.launch.browser = .rs.invokeShinyWindowViewer)
shinyApp(ui = ui, server = server) # runs in RStudio window