8

I'm using the RStudio IDE to develop shiny apps. When starting an app I usually use the RunApp Button: Run in Window. This opens the app in a window with specific width and height.

Is there a way to change the width of this window, so every time I start the app will be shown in a wider window?

Phil
  • 7,287
  • 3
  • 36
  • 66
needRhelp
  • 2,948
  • 2
  • 24
  • 48

1 Answers1

4

You can try the runGadget option:

library(shiny)

ui <- fluidPage(
  titlePanel("Hello Shiny!"),
  sidebarLayout(
    sidebarPanel(sliderInput(inputId = "bins", label = "Number of bins:", min = 1, max = 50, value = 30)),
    mainPanel(plotOutput(outputId = "distPlot"))
  )
)

server <- function(input, output) {
  output$distPlot <- renderPlot({
    x    <- faithful$waiting
    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    hist(x, breaks = bins, col = "#75AADB", border = "white",
         xlab = "Waiting time to next eruption (in mins)",
         main = "Histogram of waiting times")
    })
}

# Run in a dialog within R Studio
runGadget(ui, server, viewer = dialogViewer("Dialog Title", width = 1200, height = 600))

# Run in Viewer pane
runGadget(ui, server, viewer = paneViewer(minHeight = 500))

# Run in browser
runGadget(ui, server, viewer = browserViewer(browser = getOption("browser")))
Matt_B
  • 824
  • 1
  • 6
  • 13