6

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 runApp code to include launch.browser=rstudio::viewer, 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 runApp to open in an Rstudio window.

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

Regards

Carl
  • 5,569
  • 6
  • 39
  • 74

2 Answers2

9

To avoid opening it in an internet browser, and run it through the R-studio window, make sure you have this setting on:

enter image description here

It could be that their default setting is something else instead of just "Run in Window".

Please make sure you have the latest R-studio version as well. I just read someone coincidentally had a similar issue here:

https://stackoverflow.com/a/35311882/5874001

If this doesn't help, I will do my best to further assist you.

Community
  • 1
  • 1
InfiniteFlash
  • 1,038
  • 1
  • 10
  • 22
6

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
Carl
  • 5,569
  • 6
  • 39
  • 74